CAIRO (AP) — Egypt released early on Friday an Irish-Egyptian man detained for over four years on charges related to a 2013 Muslim Brotherhood protest in Cairo, his lawyer said.

Ibrahim Halawa's release, announced by Irish lawyer Darragh Mackin, came about a month after an Egyptian court acquitted him of charges including murder, arson and illegal possession of weapons.

Halawa was tried along with nearly 500 defendants, many of whom received sentences up to life in prison in a mass trial that was slammed by rights groups as unfair. Among those convicted was an American-Egyptian, Ahmed Eitwy. Only 52 of the defendants, including Halawa, have been acquitted.

"Finally, the day where I can see the sky without bars, smell fresh air, walk freely and smile deeply from the bottom of my heart," Halawa wrote in a Facebook post after his release Friday.

His family was not immediately available for comment.

Irish government officials and the European parliament have previously called for his release but Cairo rejected such pleas, saying they are a "violation of the independence" of its judiciary.

Amnesty International issued a statement welcoming Halawa's release as a "resounding victory."

"He should never have been jailed in the first place," said the group's North Africa Campaigns Director, Najia Bounaim.

"No one should have to face the injustice he was forced to suffer," she added, urging Egyptian authorities to release others in prison.

Also, Maya Foa, director of the U.K.-based rights organization Reprieve, said Halawa's release was "long overdue" and urged the Egyptian government to halt mass trials.

Irish officials welcomed the news as well, saying the government is working on returning the 21-year old Halawa to Ireland. He is from Dublin.

"We are helping him to get back to Ireland to be reunited with his family and get on with his life and his studies," Irish Prime Minister Leo Varadkar said. "He's receiving full consular assistance at the moment."

Irish Foreign Affairs Minister Simon Coveney said "all appropriate ongoing support that Ibrahim requires in the period ahead will be available to him."

Halawa was arrested at the age of 17, along with his three sisters, in August 2013. The Irish student is the son of a senior member of the Muslim Brotherhood, an Islamist group that swept to power in elections after the 2011 uprising but is now outlawed as a terrorist organization in Egypt.

His arrest took place days after security forces violently broke up sit-ins held in support of ousted Islamist President Mohammed Morsi, who hailed from the Brotherhood and had been overthrown by the military the previous month after mass protests against his divisive, one-year rule.

Halawa's sisters were released later in 2013, after which they left Egypt. They have been campaigning for his release since.

Since Morsi's ouster, Egypt has launched a crackdown on the country's Islamists that saw hundreds killed and thousands jailed. The security campaign also swept up liberals and young pro-democracy activists who spearheaded the 2011 popular uprising that toppled longtime autocrat Hosni Mubarak.

The government's clampdown also included civil society groups, particularly human rights organizations that receive foreign funding.

Earlier this year, Egypt also acquitted U.S.-Egyptian Aya Hijazi among others. She was held for nearly three years over accusations related to running a non-governmental organization founded to aid street children. Hijazi and others faced charges of abusing children, which were widely dismissed as bogus by human rights groups and U.S. officials.

Hijazi and her husband, who was charged in the same case, returned to the United States shortly after their release.

___

Associated Press writer Danica Kirka in London contributed to this report.