GHADAMES, Libya (Reuters) - Tuareg tribesmen and local Arabs who have fought skirmishes near this Saharan oasis exchanged hostages and signed an agreement on Friday to try to stabilize an area where some security officials believe Muammar Gaddafi has taken refuge.
At a ceremony attended by Suleiman Mahmoud al-Obeidi, the military chief of the country's new rulers, elders from the local Arab population and Tuareg nomads agreed to keep the peace and treat each other as equals in this ancient trading settlement 600 km (370 miles) southwest of Tripoli on the Algerian border.
Officials of the interim National Transitional Council (NTC), the coalition that led the effort to overthrow Gaddafi, said at the weekend that the town, which is under the control of their forces, had been attacked this month by pro-Gaddafi forces, possibly tied to one of Gaddafi's sons, Khamis.
But other sources have said it was a clash between Tuaregs and the townspeople -- a more worrying version of events for the NTC because it shows the deep divisions in Libyan society that may remain even if the last of Gaddafi's forces are defeated.
Al-Obeidi indicated that trouble had been brewing even before Gaddafi was driven from Tripoli on the weekend of August 20-22.
"I am now here to witness the agreement between Ghadames and the Tuareg. There has been a problem since July 17," he told Reuters.
He called on all the communities of the town to forget the past and work together to ensure national unity.
Under the agreement, private property is to return to its owners, displaced people are to return and young men from all the communities should take part in joint efforts to "confront extremists."
The town drew additional attention this week when Hisham Buhagiar, a military official of the NTC, said Gaddafi was believed to be hiding in the region under the protection of Tuaregs.
Al-Obeidi made no public reference to the possible presence of Gaddafi in the region on his tour of Ghadames on Friday, possibly to avoid stirring any tensions that could undo peacemaking.
Ghadames, like some other towns around Libya, has been placed under strain not only by months of military conflict between pro- and anti-Gaddafi forces but sometimes also by acts of violence by individuals and communities who have taken advantage of unrest to settle scores.
At the border post with Algeria, Libyan colonel Muftah al-Zintani told Reuters he was on alert for any signs of Gaddafi or his associates.
"We're searching the area from all directions including the border with Algeria," he said. "So far we did not find any evidence of Gaddafi's troops or vehicles crossing either way."
"This process is going on a daily basis to make sure that Gaddafi followers will not use the border to run away to Algeria."
Tuaregs, nomads who roam the desert spanning the borders of Libya and its neighbors, traditionally backed Gaddafi and have viewed the NTC with suspicion.
Many among Libya's community of Tuaregs viewed Gaddafi favorably because he supported their rebellion against the governments of Mali and Niger in the 1970s and later allowed many of them to settle in southern Libya.
The tribe is important to regional security because the Tuareg have huge influence in the vast, empty desert expanses which are often exploited by drug traffickers and Islamist militants as a safe haven for their operations.
(Writing by William Maclean; Editing by Joseph Nasr and Michael Roddy)