DOHA, Nov 23 (Reuters) - Rival tribes from southern Libya who have battled for control of oil fields signed a peace agreement in Qatar on Monday, a Qatari official said, raising hopes of an end to violence that has plagued a remote corner of the country since 2011.

Representatives of the Tebu and Tuareg, who have exploited a security vacuum to vie for control of a vast area long neglected by the government, agreed to a ceasefire and to withdraw armed forces from the flashpoint town of Ubari, the Qatari foreign ministry official told Reuters without giving further details.

In July, clashes between the two tribes reached Sebha, the biggest city in southern Libya forcing hundreds of families to flee their homes. Efforts to negotiate a truce in September were halted because of ceasefire violations.

The power struggle in the desert near Libya's border with Algeria and close to the Sharara oil field, Libya's second largest, was unleashed after the 2011 revolt and NATO air campaign that toppled Muammar Gaddafi in 2011.

Both sides accuse each other of using mercenaries.

Libya is in chaos, with two governments fighting for control while Islamic State militants exploit a security gap.

Tripoli is controlled by a government not recognised by world powers. It took office a year ago after an armed faction forced the recognised government and parliament to operate out of eastern Libya.

Rivalry between the Tebu and Tuareg goes back to before Gaddafi was toppled, though in the past his police state had succeeded in keeping some order.

(Reporting by Tom Finn, editing by Sami Aboudi and Gareth Jones) ((Tom.Finn@thomsonreuters.com;))

Keywords: LIBYA SECURITY/TRIBES