MOGADISHU, Somalia — For the past three years, the Shabab, one of Africa’s most fearsome militant Islamist groups, have been terrorizing the Somali public, chopping off hands, stoning people to death and banning TV, music and even bras in their quest to turn Somalia into a seventh-century-style Islamic state.

At the same time, they have drawn increasingly close to Al Qaeda, deploying suicide bombers, attracting jihadists from around the world and prompting American concerns that they may be spreading into Kenya, Yemen and beyond.

But could Somalia finally be reaching a tipping point against the Shabab?

Not only is Somalia’s transitional government gearing up for a major offensive against the Shabab — with the American military providing intelligence and logistical support — but Mogadishu’s beleaguered population, sensing a change in the salt-sticky air, is beginning to turn against them.

Women who have been whipped and humiliated by morality police for not veiling their faces are now whispering valuable secrets about the Shabab’s movements into the ears of government soldiers. Teenage students outraged that Shabab-allied fighters hoisted a black flag in front of their school recently pelted the fighters with stones. Defectors are leaving the Shabab in droves, including one 13-year-old who said that he was routinely drugged before being handed a machine gun and shoved into combat.