MOGADISHU - Fighting in Somalia's capital Mogadishu killed at least 12 people and wounded 17 others after Islamist insurgents attacked government forces and African Union (AU) peacekeepers, witnesses said on Wednesday.

The rebels launched overnight raids on bases around the city's strategic K4 junction, triggering gun battles and barrages of mortar shells that made residents cower indoors.

President Sheikh Sharif Sheikh Ahmed's fragile U.N.-backed administration is facing a concerted campaign by insurgents who hit the AU's main military base in Mogadishu with twin suicide car bombs last Thursday, killing 17 peacekeepers.

With its credibility increasingly in doubt, the government said it was planning a fresh offensive against the rebels -- but the guerrillas appeared to have attacked first. Witnesses said AU troops later fired shells at the capital's sprawling Bakara Market, which has long been an insurgent stronghold.

I saw three dead bodies in the street by Bakara, one resident, Abdifarah Hassan, told Reuters. Another died later.

Ambulance service coordinator Ali Musa said at least eight other corpses had been collected since the start of the clashes, and that at least 17 civilians were also wounded.

Western security agencies say the failed Horn of Africa state -- which has been torn by civil war for the last 18 years -- has become a haven for militants including foreign jihadists, who are using it to plot attacks in the region and beyond.

Fighting has killed more than 18,000 Somalis since the start of 2007 and driven another 1.5 million from their homes.

REBELS LOOT WORKSHOPS
The al Shabaab rebel group, which Washington says is al Qaeda's proxy in Somalia, said last week's attack on the AU mission AMISOM was in revenge for the U.S. killing of a senior al Qaeda suspect days earlier in rebel-held southern Somalia.

On Wednesday, a senior government official accused al Shabaab fighters of plundering an industrial training centre in the north of the capital after forcing its staff to flee.

They have looted all the equipment from the workshops, and the generators, said the state minister for defence, Sheikh Yusuf Mohamed Siad, a former warlord also known as Inda'ade.

A staff member at the institute, which was set up in part with German funding, confirmed the minister's account and told Reuters he and his colleagues had run away at gunpoint.

Inda'ade also issued a warning about the breakaway northwestern enclave of Somaliland, where the opposition is increasingly angry at repeated election delays.

Many of al Shabaab's leaders and young recruits come from the area, and Inda'ade said the group was stirring up trouble.

Our brothers in northwestern Somalia should look at what is going on in the south as an inevitable disaster for their part of the country, the minister told reporters.

We are fully aware that (al Shabaab) are preparing to turn these peaceful provinces into a hell worse than the south. They want to exploit the election crisis and are inflaming debates.