Gabon's Ali Bongo has returned to Libreville on Tuesday after months abroad recovering from a stroke, ending an absence that has spurred political turbulence.

Returning from Morocco in the early hours of the morning, Bongo presided over a ceremony in the country's capital at which ministers from the new government were sworn in, officials said.

Gabon has been without an effective government for months since Bongo, 59, suffered the stroke in late October during a visit to Saudi Arabia.

After initial treatment at a hospital in Riyadh, Bongo was transferred to Morocco where he spent just over six weeks, finally returning home to Libreville early on Tuesday, officials said.

His return came eight days after a small group of renegade soldiers briefly tried to stage a coup before it was quashed by the security forces, who arrested the leader and killed two others.

With Bongo's prolonged absence, the country had been in limbo for months and officials at the presidential palace did not say whether he was back for good or will return to the Moroccan capital Rabat for further convalescence.

Late on Saturday, a new government was unveiled in a video announcement from Rabat although there were no significant changes to either the cabinet or the government.

All 38 ministers arrived at the beachside presidential palace in Libreville on Tuesday morning and were sworn in at a ceremony presided over by Bongo which was closed to the press, officials said.

Bongo has not been seen in public since he was taken to a hospital on October 24 in Riyadh but official photos of the ceremony were due to be released later on Tuesday.

"It was very moving to see him," government spokesman Nanette Longa-Makinda told AFP news agency.

"It will certainly take him several months to fully recover his physical abilities, that's for sure," one minister said, speaking on condition of anonymity.

"He looks like someone who has been through a very difficult ordeal," agreed another cabinet member who was present at the ceremony.

"There can be no more talk about a power vacuum," a presidential spokesman insisted, echoing a phrase repeated by many ministers leaving the ceremony.

But Bongo's return and the ceremony did little to quieten lingering suspicions among the public in this oil-rich West African state.

"The circus goes on," tweeted Marc Ona Essangui, a civil society leader.

When Bongo was first taken ill, the singular lack of official news - along with memories of the secrecy around the death of his father Omar Bongo in 2009 - had fuelled a flurry of rumours, including speculation he was incapacitated or even dead.

The Bongo family has governed Gabon for five decades and has long maintained close ties with former colonial master France.

Ali Bongo was elected head of state after his father's death and he was narrowly re-elected in 2016 following a presidential poll marred by deadly violence and allegations of fraud.