Al Shabab used to rule Mogadishu's Bakara market before withdrawing from most of the capital last month. There is still fear of Shabab sympathizers and infiltrators, especially in Bakara. (Sudarsan Raghavan/Washington Post)

For the first time in three years, al-Shabab militants no longer rule Mogadishu. But the African Union troops stationed in the city are still nervous.

On a desolate stretch of Bakara market, which al-Shabab used as a base, some of the troops walked past shuttered shops and houses pocked with bullet holes during a recent visit. Young men of fighting age stared from rooftops.

“How do you tell who is the enemy?” said Maj. Paddy Akunda, a spokesman for the A.U. force, gazing up suspiciously. “It’s difficult to know who is wearing a suicide vest.”

Al-Shabab suddenly retreated from most of the Somali capital a month ago, leaving an uneasy calm in the city. A.U. and Somali government forces can now venture into the market, where the al-Qaeda-linked militia taxed merchants to fund its operations.

But hardly anyone is declaring victory over the militia. Al-Shabab still controls large swaths of territory in Somalia and has vowed to retake Mogadishu. Many Somalis fear that the relentless civil war in their country has entered a new phase in which an urban conflict with demarcated front lines has turned into one with none, fueled by attacks by al-Shabab sympathizers who easily blend into the population.

The week Akunda’s troops visited Bakara market, there were five attempted car bombings or grenade attacks, A.U. commanders said.

“The front lines are no longer visible in Mogadishu,” Akunda said. “It’s more complicated now.”

Amid power vacuum, a ‘road map’

The latest chapter in Somalia’s 20-year-old civil war comes as famine — the worst here in a generation — has killed tens of thousands. Mogadishu is filled with dozens of settlements of displaced people and long food lines, and the city’s hospitals are overwhelmed by starving children in desperate need of medical care.

During the past three years, al-Shabab grew strong enough to strike targets close to the seat of government, paralyzing it. But why the Islamist militia, which once controlled 90 percent of Mogadishu, left the city seemingly overnight remains unclear. Some blame internal divisions; others say the A.U. forces, trained by Western military personnel paid by the United States, pushed the militia out with multiple offensives this year. Analysts also say funding from al-Shabab’s Arab sympathizers has declined since the uprisings this year in the Middle East and North Africa.

Whatever the reason, A.U. officials and their international backers are hopeful that Somalia’s weak transitional government can take advantage of the power vacuum. Under pressure from international donors, the country’s political and clan leaders agreed this month to a “road map” to draft a new constitution, reform parliament and take other steps toward building an effective government.

“Al-Shabab has served as a catalyst,” said Christian Manahl, the U.N. deputy special representative for Somalia. “It has helped bring together a number of parties and clans who have been fighting each other bitterly for years.”

The militia’s decision to ban international aid from entering southern Somalia, the famine’s epicenter, also has “delivered a blow to the militia’s credibility” among ordinary Somalis, he said. Fighters have stopped people from fleeing their areas, often at gunpoint, calling the U.N. declaration of famine exaggerated.

“The key now is to maintain the momentum,” Manahl added. “We need to keep the train rolling now.”

It remains to be seen, though, whether A.U. forces and Somali leaders can press into those parts of Somalia that al-Shabab still dominates, especially in the south. And even as the A.U. troops have moved into new neighborhoods of the capital, they have been unable to exert full control.

Aid workers report that government troops and local officials routinely steal relief supplies sent by the U.N. World Food Program and sell it on the black market. There is also clear tension between Somali government officials and A.U. commanders, both of whom see themselves as the power in Mogadishu.

On the first day of the road-map meeting in parliament, A.U. commanders refused entry to Somali generals and tried to subject the city’s mayor to a search, prompting angry exchanges.

“I am the mayor of this city,” Mohamed Ahmed Noor said. “How dare they try to search me!”

Eventually, the commanders let him inside the building.

“There are so many players, so many guns and no real authority or law,” said a U.N. official, who spoke on the condition of anonymity because of the sensitivity of the matter. “They all seem to have their own agendas.”

Some Somali politicians are openly saying that they cannot meet the road-map deadlines unless the international community provides more funding to the government. In other parts of the country, tensions are rising among clans. Others worry that al-Shabab could regain strength as long as it remains in control of some neighborhoods in the capital. “If the military pursued them, they would have no chance to regroup,” Noor said.

A.U. commanders said they are stretched thin. Their 9,000-member force, made up of Ugandan and Burundian troops, is trying to control more areas across this sprawling capital than at any time in the past three years.

“Our biggest concern is consolidating the city of Mogadishu,” Col. Paul Lokech said. He worries that al-Shabab militants could infiltrate displaced people’s camps and gain recruits. “Al-Shabab still has cells within the city,” he said.

At one A.U. position in the north of the capital, Ugandan troops peered from behind green sandbags. Al-Shabab fighters were in buildings less than half a mile away. Lt. Col. Kayanja Muhanga said the soldiers were forced to pull back recently, fearing they would be overextended.

“We need more troops,” he said. “It’s affecting our operations.”

‘Be on your guard’

On a recent day in Mogadishu, Somali President Sharif Ahmed attended the opening of a market just a few miles from Bakara. He urged people to help clean the capital. Then, he got to the point.

“Al-Shabab and al-Qaeda, you know them very well,” he said. “They always infiltrate within the people. So you must be on your guard.”

When asked why Bakara was not yet operating, Noor said it would open once all the shopkeepers have been checked for weapons and for any sympathies toward al-Shabab. “They don’t need to infiltrate. They are there in Bakara,” he said.

A few blocks away, Medina Omar waited in a line to receive one bucket of food aid to feed seven relatives. The family members had fled Bakara market two years ago after shelling destroyed their house, and they have no money to rebuild. Today they live in one of the camps for displaced Somalis, unconvinced that the militia is gone forever.

“I think they will come back and slaughter the people,” Omar said.