DAKAR, Senegal — Nigeria’s ailing president, Muhammadu Buhari, had been seen in public so rarely that some Nigerians were convinced he was dead. Some of his supporters have called on him to step down, at least until his health improves.

His wife recently defended him, posting on Twitter that the president’s condition was “not as bad as it’s being perceived.”

As the worries grew, Mr. Buhari desperately needed a victory to show that he was still in control, securely at the helm. Over the weekend he got one: Dozens of the nearly 300 schoolgirls kidnapped three years ago by Boko Haram were released, by far the biggest break in a case that shocked the nation and the world.

But Mr. Buhari, 74, barely reveled in the achievement. He met with the girls briefly Sunday, then flew back to London, where he has spent nearly two months this year on medical leave.