SANA, Yemen — Two American tourists taken hostage early this week were released by tribal kidnappers on Tuesday after Yemen’s president agreed to free a prisoner held by the state, security and tribal officials said.

The release came as a bit of welcome news for the Yemeni authorities on a day when the government had to apologize for a botched airstrike that killed a prominent local official who had been trying to persuade a local leader of Al Qaeda to surrender.

The target of the attack, Mohammed Saeed Jardan, was apparently uninjured, officials said.

The release of the two Americans, their driver and a interpreter, and the backlash against the government for the errant airstrike, underscored the central government’s ongoing problems in dealing with an entrenched tribal structure that challenges the authority of the state.

The botched airstrike that killed Sheik Jabir al-Shabwani, deputy governor of Marib Province, seemed to incite even more violence as a group of armed tribesmen bombed an oil pipeline and attacked the government offices and Republican Palace.

Reports said that several people were killed in shooting between the villagers and the police, and witnesses said that 20 tanks and armored vehicles surrounded the government offices to ward off the attackers.

Angry tribesmen continued late Tuesday to block the highway between Marib and the capital, Sana. They fired at the power station, which led to a blackout in some areas of the country, including the capital.

Sheik Abdullah Ahmed al-Sharif said that tribal leaders had offered the government a three-day truce and decided to form a committee to follow an official investigation into the airstrike.

Sheik Abdullah said that the tribe would insist on holding talks with high-level security officials if Yemen was found responsible for the attack. But, he warned, if the United States was involved, he said the government would have to take action.

Working with the United States, officials in Yemen have stepped up efforts to break terrorist networks, which have long found safety in the isolated rock and desert corners of Yemen.

As the government was trying to calm the violence in the restive Marib Province, news came that the two hostages had been released and that they were already on their way back to Sana.

Their release came as President Ali Abdullah Saleh agreed to release a prisoner, Hameed Shardah, said Said Naser Sabir, a local leader of the Haima tribe, in an interview. The BBC reported that Mr. Shardah had been arrested in a land dispute.

Mohammed al-Asaadi reported from Sana, and Michael Slackman from Cairo.