TRIPOLI (Reuters) - Ten people were killed and dozens wounded as Libyan militias operating alongside the defense ministry shelled the former Gaddafi stronghold of Bani Walid and faced counter-attacks, a resident and medical source said on Wednesday.

The hilltop town was one of the last to surrender last year to the rebels who overthrew dictator Muammar Gaddafi. It has come back into focus with the death last month of rebel fighter Omran Shaban after two months of detention in Bani Walid.

Shaban, from nearby Misrata, was the man who found Gaddafi hiding in a drain pipe in Sirte on October 20, 2011.

Libya's ruling national congress had ordered the defense and interior ministries to find those who abducted Shaban and were suspected of torturing him to death. It also gave Bani Walid a deadline to hand them over.

Elders have tried to negotiate a solution as militias have taken up position around parts of the town, at times clashing with local fighters.

"Bani Walid has been shelled since this morning from three sides - the south, the east and southeast," Colonel Salem al-Wa'er, a spokesman for Bani Walid's fighters, said by telephone.

Without giving details, he said Bani Walid fighters had stopped a car which was carrying gas masks. A resident said six people had been killed in Bani Walid and "tens" wounded.

"Fighting stopped in the evening," the resident said.

A Misrata hospital source said three fighters from Misrata and one from the town of Zlitan were killed in counter-attacks from Bani Walid, with another 23 people injured.

Militia forces from Misrata and other towns, operating together in a coalition known as Libya Shield affiliated to the Defence Ministry, have deployed around parts of Bani Walid.

Shelling last week came mainly from the area of al-Mardum, about 25 km (15 miles) along the road to Misrata.

A military source said no order of an assault had been given from the army chief of staff on Wednesday.

Tensions between Misrata and Bani Walid underscore the challenge Libya's new rulers face in reconciling groups with long-running grievances.

While Misrata spent weeks under siege by Gaddafi forces in last year's war, Bani Walid, 140 km (90 miles) away, was one of those that remained loyal to Gaddafi longest. The town of around 70,000 remains isolated from the rest of Libya and former rebels say it still harbors pockets of support for the old government.

(Reporting by Ali Shuaib; Writing by Marie-Louise Gumuchian; Editing by Jon Hemming)