An immigration judge has ordered the deportation of a man who was detained on Long Island earlier this year.

Rafael Rubio, a New York City Council staffer, was originally held after a routine asylum appointment in Bethpage in January.

The 45-year-old is now being ordered to return to Venezuela, according to council speaker Julie Menin.

Menin released a statement Wednesday saying the ruling is based on a technical error.

“This outcome does not change the fundamental facts of this case: Rafael had legal authorization to remain in the United States, he followed the rules, and he showed up for a routine immigration appointment — only to be detained and held for months now,” she continued.

The city council says an appeal will be filed.