The men were held for possession of arms in Egypt, but subsequent investigations cleared them of "involvement in any terrorism in Egypt", the security sources said.
The release followed talks on Saturday between Egypt and representatives of Hamas and Islamic Jihad as part of a push for a truce between the militant groups and Israel. The Palestinians called for the release of Hamas members held by Egypt.
A Hamas spokesman said on Saturday Egypt had promised to release the Gazan detainees. However, as of Sunday one Hamas detainee, described by sources in the Islamist group as the most senior among those detained, was still being held by Egypt.
Earlier this week, senior Hamas official Saeed Seyam said in an interview posted on the Internet the detainees were tortured in Egyptian jails, and interrogators wanted to know the location of captured Israeli soldier Gilad Shalit.
Shalit, then 19, was captured by Palestinian gunmen in a cross-border raid into an Israeli army base in June 2006.
Hamas has said it will not release Shalit unless Israel frees nearly 1,400 Palestinian prisoners, including 350 with life sentences. Israel has rejected these terms.
Human rights groups say torture is systemic in Egyptian jails and police stations. The government says it opposes torture and prosecutes torturers if evidence is found.
Hamas militants blew open Gaza's southern border wall with Egypt in January to break an Israeli-led siege on the territory, home to 1.5 million Palestinians, allowing Palestinians to flood into Egypt to buy supplies. The border has been resealed.
Egypt previously released around 50 Hamas members also detained after the border was breached.