ABUJA, Nigeria — Muhammadu Buhari won the presidency in a historic election in Nigeria four years ago by promising to crush two scourges that had plagued the nation for years: endemic corruption and a war with Islamist extremists.

Back then, Mr. Buhari, a former military general, rode a wave of voter desire to impose greater accountability on the government, end a brutal war with the extremist group Boko Haram and bring back the hundreds of female students taken as captives.

Now, as Mr. Buhari is in the final throes of a bruising re-election campaign, he stands accused of falling short on all fronts.

Critics say Mr. Buhari has used his antigraft mantra to crush adversaries. Boko Haram is gaining ground, launching sophisticated attacks on weary, underequipped soldiers. And many of the captive students are still missing.