Outgoing President Ali Abdullah Saleh apologised for "any shortcoming" in his 33-year rule before leaving Yemen for the United States on Sunday, paving the way for a transfer of power after a year of unrest.
"God willing, I will leave for (medical) treatment in the United States and I will return to Sanaa as head of the General People's Congress party," Saleh told senior party and government officials in a televised speech.
The U.S. State Department confirmed it had given him a visa.
"The sole purpose of this travel is for medical treatment and we expect that he will stay for a limited time that corresponds to the duration of this treatment," it said.
Saleh tried to sound a conciliatory note in a farewell speech that came a day after he was granted immunity from prosecution under a law passed by parliament.
"I ask for pardon from all Yemeni men and women for any shortcoming that occurred during my 33-year rule and I ask forgiveness and offer my apologies to all Yemeni men and women," he said. "Now we must concentrate on our martyrs and injured."
An aide to Saleh said he would spend two or three days in neighbouring Oman, but an Omani official told Reuters the veteran ruler would be in transit for only a few hours.
Thousands of Yemenis protested on Sunday against Saleh's immunity and demanded he be put on trial for the killing of hundreds of demonstrators during a year of unrest that brought the impoverished Arabian Peninsula country to the verge of civil war.
Saleh was granted the immunity as part of a plan hammered out by neighbouring Gulf states to ease him from power. Gulf Arab and Western allies fear instability has given al Qaeda militants room to entrench themselves further in remote areas outside central government control.
He leaves behind a divided country.
An opposition-led government formed as part of the deal to get him out of office is preparing for a presidential election on Feb. 21 expected to replace Saleh with his ally and vice-president, Abd-Rabbu Mansour Hadi, in a power-sharing arrangement.
The Yemeni Embassy in Washington said Saleh would return home for the inauguration of his successor.
"The president, will travel back to Yemen in February to attend the swearing-in ceremony of the newly elected president. No further details will be provide in advance," the embassy said in a statement.
Saleh remains nominal head of state until then, although he has transferred his powers to Hadi. Saleh said on Sunday he had promoted Hadi to army general, an apparent effort to ensure the army remains the most important institution in a fragmented land of 23 million.
Many fear that although Saleh may be gone, his supporters will remain in power and continue to dominate the country.
At the capital's airport, dozens of members of Yemen's air force held a sit-in on the runway to demand the resignation of their commander, Saleh's half-brother, accusing him of corruption. Air traffic was halted and riot police with water cannon surrounded the protesters, witnesses said.
Reports from a pro-revolution website run by Saleh's arch-enemy, General Ali Mohsen, said about 600 members of the air force were participating in the sit-in.