Gabon's ailing President Ali Bongo left Morocco on Monday to fly home days after security forces there foiled an attempted coup, a source close to the leader said.
"Doctors have judged that the journey does not present any danger for his health," the source said, after the president's stay in Morocco to recover from a stroke in October during a visit to Saudi Arabia.
The president's departure was confirmed by Gabon's embassy in the Moroccan capital Rabat, where Bongo had been staying at a private residence following a period in a military hospital.
Bongo is due to arrive in the Gabonese capital Libreville on Tuesday, in time to preside over the swearing in ceremony of the new government which was announced in his absence.
The president suffered a stroke on October 24 in Saudi Arabia and was hospitalised for a month in the capital Riyadh, before being transferred to Morocco.
Initial silence by officials over the president's health led to speculation in Gabon over his well-being, with Bongo addressing his compatriots for the first time since his stroke with a New Year's video message.
Despite the president promising to "meet you again soon", renegade soldiers stormed a state radio station on January 7 and called for an uprising during his absence.
Security forces captured the rebel chief and killed two of his men in Libreville, after which Prime Minister Julien Nkoghe Bekale announced a new government.
The reshuffle was announced on Saturday in a video message recorded by the premier from Morocco.
Bongo's return to Libreville allows ministers to fulfil their constitutional duty by taking their vows in front of the president.