DAKAR, Senegal — Amid fears that Islamist militants were closing in on the major city in Nigeria’s northeast, hundreds of residents were said to be fleeing Maiduguri on Thursday in the face of doubts that the army could repel an attack on the metropolis of more than one million people.

The militant group Boko Haram has captured towns to the north, south and east of Maiduguri in recent months in a series of bloody assaults, and appears also to have taken control of the last major town on the road southeast of the city, Bama, 45 miles away, according to reports on Thursday in Nigerian news media and accounts of witnesses. The militants have already announced in video messages their intention to carve out an Islamist territory in Nigeria’s north. A successful attack on Maiduguri, the birthplace of Boko Haram, a major commercial and government hub and the capital of Borno State, would represent a significant advance.

“It’s very tense,” said Maikaramba Saddiq, a human rights activist in Maiduguri and the local head of Nigeria’s Civil Liberties Organization. “The Boko Haram have taken over Bama town. That’s why many of them are running away. They think the next target is Maiduguri.”

The State Department’s top diplomat for Africa delivered a stark warning about what she said was the “worsening” security situation in the country, in remarks in the Nigerian capital, Abuja, on Thursday.