At the end of his nine-minute speech, Mr Buhari said that he deliberately came back towards the weekend "so that the vice-president will continue and I will continue to rest".

One of his advisers tweeted that he was joking and his office has clarified that the formal constitutional procedure for him to retake the reins of power will happen on Monday.

What next for Buhari? Martin Patience, BBC News, Lagos

Image copyrightNigeria PresidencyImage caption
President Buhari has said that he is "feeling much better now"

President Buhari was in good spirits, joking with senior officials and journalists.

But as his address went on the president appeared to ramble, referring to the importance of technology and education. He even urged Nigerians not to self-medicate.

These comments will do little to reassure critics who are questioning whether the president is fit enough to hold office.

His every public appearance in the coming days will be scrutinised with an unusual intensity for any signs of weakness.

Comparisons will also be drawn to the vice-president, who displayed an energy as acting leader in the past few weeks that was strikingly different to President Buhari's own style.

The president may be back but for now it is not business as usual.

An official statement on Thursday said President Buhari had left Nigeria for a "vacation, during which he had medical check-ups".

"The holiday was extended based on doctors' recommendation for further tests and rest."

The president handed power over to Mr Osinbajo in January before he left for the UK.

The country is currently suffering from its worst economic crisis in years, following a sharp fall in the price of oil, its major export.

It is the second time in less than a year that Mr Buhari, who won elections in 2015, has sought medical assistance overseas. Last June, he spent nearly two weeks, again in London, for treatment for an ear infection.

Little information has been made public about his latest stay in the UK capital, but he was pictured on Thursday meeting the most senior cleric of the world Anglican congregation, Archbishop of Canterbury Justin Welby.