BEIRUT, May 25 (Reuters) - Two Syrian rebel groups which have been fighting each other near Damascus have negotiated a ceasefire in Qatar, statements published by the two groups said.

More than 500 people have been killed since April when fighting erupted between rival Jaish al-Islam and Failaq al-Rahman groups. Their rift has been exploited by Syrian government forces to capture territory in the Eastern Ghouta area outside Damascus.

"A complete ceasefire agreement was arrived at, overseen by the High Negotiations Committee chief coordinator Dr Riad Hijab," a Jaish al-Islam statement released overnight said, adding that the talks had taken place in Doha.

Qatar has been a major sponsor of armed groups fighting to topple President Bashar al-Assad in the five-year-long war.

Jaish al-Islam is part of the opposition High Negotiations Committee (HNC). It is one of the biggest Syrian rebel groups and has been the dominant faction in the Eastern Ghouta.

Failaq al-Rahman, also an Islamist group, has been supported in the battle against Jaish al-Islam by fighters linked to the al-Qaeda's Nusra Front.

A number of attempts at mediation had failed to halt the fighting.

Last week, Syrian government forces and allied militia seized an extensive area southeast of Damascus from rebels in what the Observatory said was one of the most significant government advances this year.

The statements said representatives of the two groups met in Doha, Qatar and concluded an agreement on Tuesday to stop fighting, to release detainees, to open roads to civilians and to return civilian institutions to their owners.

They also agreed to halt inflammatory media campaigns and to form a court to rule on deaths which have occurred.

(Reporting by Lisa Barrington; Editing by Tom Perry) ((lisa.barrington@thomsonreuters.com; +961)(0)(1954456;))