A Mexican father who hid out in a North Carolina church for close to a year to avoid deportation was detained when he attended an appointment with immigration officials.

Samuel Oliver-Bruno, 47, had a scheduled meeting Friday at a Raleigh-area immigration office to provide fingerprints and discuss a petition to delay his deportation, so that he could stay in the country with his wife and son, who is a US citizen, local outlets reported.

About 20 minutes after he walked into the office, plainclothes US Immigration and Customs Enforcement officers arrested him.

The CityWell United Methodist Church’s pastor, Cleve May, and more than two dozen other people who’d accompanied Oliver-Bruno to the appointment surrounded the car taking Oliver-Bruno away and were also arrested, CNN and the Effingham Daily News newspaper reported.

The pastor said church member feared the immigration appointment had been a trap set up by ICE to nab Oliver-Bruno — who came to Greenville NC., from Veracruz, Mexico more than 20 years ago.

Congressmen David Price and G.K. Butterfield, both North Carolina Democrats, said they were “extremely alarmed” by the detention.

“It appears ICE has acted in concert with officials at USCIS, who instructed Mr. Oliver-Bruno to appear at local USCIS offices to discuss his deferred deportation,” the lawmakers said in a statement.

During his 11 months hiding out in living quarters built for him inside the church, Oliver-Bruno attended English classes, played guitar and read during services.

“He helped construct his living quarters. He’s remarkable. He’s very generous and kind,” May told CNN.

Oliver-Bruno will remain in US detention for the duration of his case.