US Immigration and Customs Enforcement unconstitutionally held an Ivory Coast asylum-seeker for nearly three years without a bail hearing as they tried to send him back to his home country, a Manhattan federal judge has ruled.

“[Thirty-four] months of detention is too long without an opportunity for bail,” Judge Alvin Hellerstein wrote of Adou Kouadio, who fled the west African nation and sought entry at the US border in El Paso, Texas, in February 2016.

“His right to liberty is as valuable to him as it is to any US citizen, and he has a constitutional right to a bail hearing that should no longer be denied to him,” the judge wrote.

ICE policy is to detain all asylum-seekers, although it can parole them at its discretion. The agency wants to send Kouadio back to Ivory Coast, but his appeal is dragging on and ICE refused to parole him while the process played out.

US Citizenship and Immigration Services officials first interviewed Kouadio in March 2017 and deemed his fears of political persecution back home credible.

Kouadio told US officials he was repeatedly threatened by partisans of Ivory Coast President Alassane Ouattara for supporting the country’s controversial former president Laurent Gbagbo, who has been on trial at The Hague for allegedly fomenting civil unrest following his 2010 election loss to Ouattara.

Kouadio claimed members of Ouattara’s Rally of the Republicans party twice broke into his house — forcing him to move his wife and four kids to Ghana, he said.

“If I go back, they will kill me,” Kouadio said in the interview.

But a month later, ICE deemed him a “removable alien” and ordered him detained as a flight risk until he could be booted.

“He had potential path to citizenship and protection in Ghana,” federal immigration Judge Mimi Tsankov said in a 2017 decision.

Kouadio appealed, and the case was repeatedly delayed for various reasons including lack of a translator, before he filed a habeus corpus petition, which the judge allowed.

Hellerstein granted the request Thursday. ICE must now prove Kouadio is a flight risk or let him go free while he appeals his removal.

“Petitioner has a clean record, never having been arrested or convicted,” Hellerstein wrote. “There is little risk of flight, judging from his lack of a prior criminal history.”

The feds have 14 days to comply with the judge’s orders and hold a bail hearing for Kouadio.

“We are not advocating for everyone to be released — we are advocating for some due process,” said Kouadio’s attorney, Craig Relles.

A rep for the Manhattan US Attorney’s Office declined to comment. ICE officials said they could not comment because of the ongoing government shutdown.