A judge on Friday formally sentenced an All Saints-by-the-Sea Episcopal Church employee, who was then immediately taken into custody by U.S. immigration officials.

Carlos Ruano

Carlos Ruano, 67, was sentenced to 360 days in jail and three years of formal felony probation after he agreed to plead guilty to one felony count of false imprisonment — effectively avoiding a second trial in a felony molestation case.

Ruano, who has been the Montecito church’s sexton since 2005, accepted the plea offer last month following a mistrial Sept. 26.

Since he had been in custody for more than a year, Ruano was given credit for time already served, according to Deputy District Attorney Brandon Ladinig, who prosecuted the case.

Prosecutors offered the deal after a jury failed to come back with a unanimous verdict, deadlocking 9-3 after four days in favor of conviction Ruano of lewd conduct against a minor — his then 7-year-old step-granddaughter — during an incident that allegedly took place last July in his Santa Barbara home.

A hung jury meant Ruano, who as sexton oversaw buildings and the logistics of all church events, could have faced another trial.

Ruano was also ordered to have no contact with the victim and her family, and must comply with terms and conditions as ordered by probation officials.

On Friday morning, Ruano appeared in a Santa Barbara courtroom for sentencing, having been released from county jail after the October arraignment into the custody of U.S. Immigration and Customs Enforcement.

ICE then allowed Ruano — described by Montecito church members as a Guatemalan political refugee who arrived in the country in the 1980s — to return home while officials reviewed his case to determine the next course of action.

Virginia Kice, an ICE spokeswoman, said Ruano was taken into custody after Friday’s sentencing hearing. She added that he has been deported previously, and that ICE will seek to reinstate his prior deportation order and remove him from the country.

“ICE is focused on sensible, effective immigration enforcement that prioritizes efforts first on individuals who present the greatest risk to our communities,” she said.

The prosecutor said he had no information on Ruano’s immigration status because that is strictly a federal issue.

— Noozhawk staff writer Gina Potthoff can be reached at gpotthoff@noozhawk.com. Follow Noozhawk on Twitter: @noozhawk, @NoozhawkNews and @NoozhawkBiz. Connect with Noozhawk on Facebook.