Immigration and Customs Enforcement (ICE) reportedly detained a U.S. citizen for nearly two years and tried to have him deported.

Levy Jaen, a father of four, was held in a New Jersey ICE detention facility as his attorneys argued with federal prosecutors over how immigration is passed from parent to child and how ICE determines “family,” BuzzFeed News reported Monday, the same day the White House held an event honoring immigration agents.

Jaen, 46, was born in Panama, although his parents were living in New York at the time. His father later became a citizen.

His mother was allegedly having an affair at the time, and his original birth certificate lists another man. His mother stayed in the marriage, and Jaen spent his life with the man he considered his father. 

BuzzFeed News reports that Jaen came to the U.S. in 1988 at the age of 15 on a visa and has lived in New York ever since, assuming he earned American citizenship through his father.

He was, however, detained by immigration officials in May 2016 after he completed a two-year sentence for his second drug possession conviction. 

ICE tried to have him deported for overstaying a visa and his drug charges.

His attorneys argued that he was born into a marriage where one of his parents — the man he always considered to be his father — was a U.S. citizen, so he was as well.

ICE attorneys said that his father could not pass on citizenship to Jaen without a biological relationship.

“It is really striking for the government to be running around telling marital families that ‘no, this isn’t really a family,’ ” Ian Samuel, one of his attorneys, said. “That offends some of the oldest instincts we have as a civilized people.”

Jaen remained inside the Hudson County Correctional Facility, away from his four children, the youngest of whom is autistic.

“ICE seemed totally unconcerned they were imprisoning and deporting a U.S. citizen," his immigration attorney, Andrea Saenz, told BuzzFeeed News. “I felt that they only saw him as a person with a criminal history.”

It wasn’t until April when a 2nd Circuit Court of Appeals reaffirmed his citizenship and ordered for him to be released, BuzzFeed News reported.

He was reunited with his children at their home in Queens that same day.

“I felt that weight uplifted from my back. It was the happiest day of my life for me, my kids and my family,” Jaen told the outlet.

The court issued its written opinion last week, arguing that the country has long recognized that a child born into a legally married couple is considered the child of the husband — regardless of biological relations.

That has been the standard at the state and federal level for decades, the judges ruled.

“This presumption has reflected the traditional 'aversion to declaring children illegitimate,' as well as an interest in promoting familial tranquillity through deference to the marital family,” the court wrote in the ruling obtained by BuzzFeed News.

There is not legal requirement for a parent and child to have a biological relationship in order to pass on citizenship, the judges found. 

“At least I got an opportunity to be back with my kids. Little by little, my kids know that Dad is home. All the pain and suffering — that is always going to be there,” Jaen told the outlet.