SANAA, Yemen (AP) — A car bomb outside the gate of a presidential compound in a southern Yemeni city killed at least 25 people, a health official said, hours after the country’s new president was formally inaugurated and vowed to fight al-Qaeda.

A security official said it was a suicide blast, and that it bore the hallmarks of an operation by the militant group. He did not provide a death toll. Both al-Qaeda and southern separatists are active in the region.

Both officials spoke on condition of anonymity as they were not allowed to speak to the press.

The blast came as Abed Rabo Mansour Hadi was sworn in as president to replace longtime leader Ali Abdullah Saleh, following an election aimed at ending over a year of political turmoil.

In his televised speech before parliament, Hadi swore to keep up Yemen’s fight against al-Qaeda-linked militants, who took advantage of the country’s upheaval to seize control of several parts of the country.

Hadi also pledged to work to bring home the thousands of internal refugees created by fighting between government troops, southern separatists, mutinous military units, tribal movements, and numerous other factions.

“One of the most prominent tasks is the continuation of war against al-Qaida as a religious and national duty, and to bring back displaced people to their villages and towns,” Hadi said.

Hours later, the bomb exploded in the city of Mukalla in the province of Hadramout, part of formerly independent south Yemen, that federated with the north in 1990.

Ahmed al-Rammah, who witnessed the blast, said by phone from Mukalla that he saw a pickup moving slowly to the gate as soldiers were coming out. Then it exploded, he said. The blast was followed by heavy gunfire from the surviving guards.

Newly inaugurated President Hadi has an onerous task ahead of him bringing stability to Yemen. He must restructure powerful security forces packed with Saleh loyalists, launch a national dialogue that would include southern secessionists, and appease a restless religious minority in the north as well as disparate opposition groups in the heartland.

An unexpectedly large turnout for the Tuesday vote gives Hadi a strong popular mandate to tackle these problems.

Election Commission chief Mohammed al-Hakimi said Friday that 6.6 million people out of a potential 10.2 million voted. Of those, over 99 percent selected the only option on the ballot — to vote “yes” for Hadi — with the remaining ballots invalid.

The election was arranged as part of a US- and Gulf-backed power transfer deal signed in November. Washington has played an active role in the transition, in hopes that Hadi can head off chaos and ensure cooperation against the country’s active al-Qaeda branch.

Government operations have failed to oust the group, which is blamed for trying to blow up a US-bound airliner in 2009 and cargo planes bound for the US a year later.

Saleh meanwhile returned to Yemen early Saturday after spending about three weeks in the US receiving treatment for injuries he suffered during a June rocket attack on his compound that helped hasten his departure.

Saleh had pledged to return to Yemen for his successor’s inauguration. His party said on its website that he would arrive in Sanaa to a large popular reception.

Saleh is the fourth Arab leader swept from power by the Arab Spring. But thanks to his continued presence in the country and his negotiated exit, the political changes brought by his ouster may be much less dramatic than the results of uprisings in Tunisia, Egypt, and Libya.

Many fear that the ex-president, who has cast a large web of tribal and family relations during his three decades of rule, may still try to pull the strings during the transitional period until a new constitution is written.

Hadi called on all political parties to abide by democracy as a means to take Yemen out of its crisis.

“Expected changes don’t come by mere wishes and hopes but through democratic dialogue, and through a serious and correct approach to the key issues that racked the country,” he said.

The election saw several attacks against polling stations in the southern province of Aden, but Hadi vowed in his oath to preserve the country’s unity.

“I swear by Almighty God to uphold the republican system, respect and preserve the constitution and the unity and independence of Yemen,” he said.

The ceremony was attended by the US, and EU ambassadors, and several Arab envoys.