Updated

The Obama administration will allow Yemen's outgoing president to come to the U.S. temporarily for medical treatment, a move aimed at easing the political transition in Yemen, a key counterterrorism partner.

A senior administration official said Ali Abdullah Saleh would travel to New York this week, and probably stay in the U.S. until no later than the end of February. U.S. officials believe Saleh's exit from Yemen could lower the risk of disruptions in the lead-up to presidential elections planned there on Feb. 21.

A presidential spokesman in Yemen said Saleh had left the capital of Sanaa earlier Sunday on a jet headed for the Persian Gulf sultanate of Oman. An official close to Saleh, speaking on condition of anonymity because he was not authorized to discuss the trip, said the president would undergo medical exams in Oman before heading to the U.S.

The U.S. official did not say whether Saleh planned to return to Yemen, Oman or elsewhere after finishing his treatment in the U.S. The official was not authorized to discuss details about Saleh and spoke on condition of anonymity.

The Yemeni embassy in Washington said Saleh planned to return home in February to attend a swearing-in ceremony for the country's newly elected president.

The mercurial Saleh, who ruled Yemen for more than three decades, agreed to transfer power to his vice president late last year in exchange for immunity from prosecution. He had faced months of protests calling for his ouster, to which the Yemeni government responded with a bloody crackdown, leaving hundreds of protesters dead and sparking wider violence in the capital with rival militia.

Even after agreeing to leave power, Saleh continued to wield his influence behind the scenes, and U.S. officials believed getting him out of Yemen was necessary in order to ensure the February elections took place. The U.S. also worried about instability in a nation grappling with growing extremism, including the dangerous al Qaeda branch known as al Qaeda in the Arabian Peninsula.

Still, Saleh's request last month for a U.S. visa put the Obama administration in the awkward position of either having to bar a friendly president from U.S. soil or risking appearing to harbor an autocrat with blood on his hands.

As U.S. officials weighed Saleh's request, they sought assurances that he would not seek political asylum or any type of permanent relocation in the U.S.

"We wanted to make sure that there was an understanding that it would be for medical purposes and that's what it is for," John Brennan, President Barack Obama's top counterterrorism adviser, said Sunday.

Saleh was badly burned and wounded during a June rocket attack on his compound in Yemen. He sought medical treatment in neighboring Saudi Arabia for three months. American officials had hoped he would remain there, but the Yemeni leader returned and violence worsened anew.

Protesters and human rights groups have criticized Saleh's immunity clause and insisted he stand trial for his alleged role in protester deaths.

Brennan said there was a divide in Yemen over Saleh's future, with some Yemenis supporting Saleh's decision to seek medical treatment in the U.S. In the short-term, he said, it was imperative to ensure that the February elections take place.

"We thought it was important, given where Yemen is right now as far as moving forward with its political transition, to do what we can to support the government and the elections that are scheduled for the 21st of February, and that seems to be on track," he said.

Yemeni Vice President Abed Rabbo Mansour Hadi is expected to be rubber-stamped as the country's new leader in the elections, in which he is expected to be the only candidate.

Brennan spoke with Hadi on Sunday, and told him the U.S. was encouraged by his leadership during a difficult period of transition. With fresh demonstrations likely in the weeks leading up to the elections, Brennan urged Hadi to ensure that Yemeni security forces exercise restraint.

The Obama administration's approval of Saleh's visa brought back memories from three decades ago, when President Jimmy Carter allowed the exiled shah of Iran into the U.S. for medical treatment. The decision contributed to rapidly worsening relations between Washington and Ayatollah Ruhollah Khomeini's revolution in Tehran, with Iranian students occupying the U.S. Embassy in Iran a month later.

Fifty-two American hostages were held for 444 days in response to Carter's refusal to send the shah back to Iran for trial.