Sanaa, Yemen (CNN) -- Yemen's new president on Saturday promised to continue the fight against al Qaeda, calling it "a religious and national duty" for citizens of his restive nation.
Abdurabu Mansur Hadi was sworn in Saturday in the capital, Sanaa. The ceremony cements a power transfer deal reached in November to end months of protests and violence over outgoing leader Ali Abdullah Saleh's longtime rule.
Hadi -- who served as Saleh's vice president and became acting president in November in an agreement brokered by the Gulf Cooperation Council -- was sworn in before Yemen's parliament.
President Barack Obama called Hadi to congratulate him and to say that the United States "will stand with the people of Yemen as they continue their efforts to forge a brighter future for their country," according to a White House statement.
"Under President Hadi's leadership, Yemen has the potential to serve as a model for how peaceful transitions can occur when people resist violence and unite under a common cause," Obama said, warning that much work still lies ahead.
Before Hadi took power, the Yemeni government had been engulfed in anti-Saleh protests and for years has been fighting al Qaeda militants.
And as Hadi was being sworn in, a deadly car bomb killed more than 20 security force members in another part of the nation.
The explosion occurred in Hadramout province, near the presidential palace in Mukalla, the provincial seat, a senior security official and an eyewitness said.
The Mukalla palace is one of several presidential palaces throughout the country. Hadramout province is in the country's east; Sanaa is in the west.
"Yemen is a country where such attacks take place, so this is not a surprise," said Ali Saeed Obaid, a government official.
No one has yet claimed responsibility. Al Qaeda in the Arabian Peninsula is one of al Qaeda's strongest branches.
Speaking about the fight against al Qaeda, Hadi said he hoped an effort to eradicate militants would lead to the return of displaced persons to their towns and villages.
"The country does not need additional crises to deepen its wounds, as the next period requires serious dialogue and clear outlines through a new constitution that meets the national expectations," Hadi said.
He talked about the importance of reviving the middle class.
"We have to employ our energies in all walks of life and make security a reality that is felt by the citizen."
On Monday, a formal inauguration will take place in Sanaa -- one that Saleh is expected to attend. A spokesman for the country's embassy in Washington said late Friday that Saleh had returned home after a short U.S. visit for medical treatment.
"The inauguration on Monday will only be ceremonial and a celebration in support for Yemen's new leader," said Abdul Aziz Jubari, a member of Yemen's parliament from Saleh's General People's Congress party.
Hadi received 99.8% of the 6.6 million votes cast in Tuesday's election, according to Mohmmad Hassan al-Hakimi, chairman of the Supreme Committee for Elections and Referendum.
Saleh, who led Yemen for 33 years, was wounded in a June assassination attempt at his presidential palace during battles between government troops and tribal fighters.
A "massive celebration" was being planned for Saleh, who will not necessarily disappear from Yemeni politics, said Abdu Ganadi, his senior aide.
"Saleh has the option to continue involvement in politics, and the power transfer deal will not force him to step aside," Ganadi said. "He is the leader of the GPC, and his voice and support will continue being heard in the GPC."
U.S. Secretary of State Hillary Clinton called the Yemeni election "another important step forward in their democratic transition process."
Gerald Feierstein, U.S. ambassador to Yemen, said it was a great day for the country.
"I think a lot of credit goes to the Yemeni people and to the Yemenis political leadership for guiding this country successfully through some difficult challenges so far," he said. "This is just the beginning of the real transition process which is going to play out over the next couple of years.
U.N. envoy to Yemen Jamal bin Omar said the Arab nation "is turning the page."
He said an upcoming "national dialogue conference" will be an "opportunity to draft a new constitution that will be a new social pact among the Yemenis."
Human Rights Watch has called on Hadi to make changes without delay.
"Yemen's potentially historic transition will be off to a shaky start unless Hadi makes an immediate break with the abuses of the past," said Letta Tayler, the rights group's Yemen researcher. "Yemen's new leader needs to move decisively to usher in promised reforms that uphold human rights and the rule of law."
The 65-year-old Hadi is a British-, Egyptian- and Soviet-trained army officer, recently promoted to field marshal. He had been vice president since 1994 and ran for a two-year term as president on pledges of improving security and creating jobs.
But he's never had much of a power base, and Yemen's problems are expected to take longer than two years to fix. Yemen is the poorest country in the Middle East, with a severe shortage of water and rising levels of malnutrition among its population of about 25 million.
Saleh faced a separatist movement in the south, sectarian tensions in the north and the growing presence of what Western officials describe as al Qaeda's most dangerous affiliate, al Qaeda in the Arabian Peninsula.
CNN's Jamie Crawford and Kindah Shair contributed to this report.