The groups, which run rival governments in the Gaza Strip and West Bank, pledged in May to form a joint government to prepare for elections. Those efforts stalled because of disagreements, including over who would be the prime minister.

They agreed during talks in Cairo to a mutual prisoner release. Each side has been rounding up supporters of its rival.

Izzat Rashaq, a top Hamas member, said Sunday all detainees will be released before the end of the holy month of Ramadan in about three weeks.

Chief Fatah negotiator Azzam Al-Ahmed said most of the detainees on both sides had been released already, and the remainder would soon be freed.