LAGOS, Nigeria — Throngs of cheering people lined a freeway in Abuja, Nigeria, over the weekend to welcome a countryman who has spent much of 2017 overseas: the president.

President Muhammadu Buhari arrived in the capital on Saturday, and the nation breathed a collective sigh of relief that its leader had returned from London, where he had spent more than 100 days receiving treatment for a mystery illness. It was his second medical leave this year.

With the president abroad and little information available about his condition, some old wounds in the country have begun to reopen.

“I am so glad to be home,” Mr. Buhari said in an address on Monday.

But he returned to a country whose oil-dependent economy is in turmoil and where the Islamist militant group Boko Haram has been escalating attacks on the military and civilians in the northeast. Millions are suffering from a humanitarian crisis set off by the war, which is in its eighth year.