CLANTON, Ala. — Believing it was his calling to reach out to people Jesus called “the least of these,” Pastor Ricky Martin built a little church and opened a camp out back for some of society’s most unwanted people: sex offenders.

With the help of some former inmates convicted of rape, sodomy, child sexual abuse and other crimes, Martin raised a gray-block chapel in a rural patch of central Alabama in 2010, and parked old campers and recreational vehicles behind it to house the men. More than 50 convicted sex offenders have lived there since.

The camp came to an end Tuesday, when a law passed by the Alabama Legislature this year shut down Martin’s sex offender refuge.

Martin said he will make the remaining men leave the half-dozen campers parked behind the church, although he doesn’t like it. “This is a state coming against a ministry,” he said.

Prosecutor C.J. Robinson, who pushed for the local law that legislators passed to close down the camp, said this week he doesn’t doubt the sincerity of Martin’s religious beliefs. He said no one living at the camp has been arrested for additional sex-related crimes. And, he said, sex offenders do need a place to live.

If not behind a tiny church in an agricultural county with about five dozen people per square mile, then where?

Robinson said he doesn’t know. But having so many ex-convicts with similar criminal records in one place is a public safety threat, he said, and Martin doesn’t have the specialized training and credentials to deal with them.

“I think his motives are good. I just disagree with the way he’s going about it,” said Robinson, the chief deputy district attorney.

Like other states, Alabama restricts the areas where sex offenders are required to live, barring anyone convicted of certain crimes to reside within 2,000 feet of a school or day care. Laws are even stricter about where offenders can work or hang out, restricting them from being within 500 feet of parks, athletic fields or businesses where kids gather.

Inmates serving time for sex crimes must tell authorities where they plan to live after their release, and prisons or county jails must continue holding anyone who can’t prove they have a legal place to live.

Martin, who runs a small upholstery shop beside his Triumph Church when he’s not ministering, said he met men with no place to go while serving as a volunteer chaplain in a state prison. He came up with the idea of a sex offender refuge in rural Chilton County, far away from any schools or day care centers, and began screening potential prisoners to live there.

Some of the released prisoners helped build the church, which stands between the road and the camp, which in turn is partially encircled by a wooden privacy fence. The residents, all men, pay when they can and abide by strict rules: No smoking or drinking, and no more sex crimes.

Martin and his wife live in a house and keep watch over the camp and church, which ranges in attendance from a handful to as many as 60 people depending on the day.

“We try to live Christian,” said Kenny Dark, who served time for rape and has lived in one of the campers. “We go to the church Wednesday and two times on Sunday. We help each other.”

Martin said he is simply living out his faith by offering a hand to people rejected by society.

“You know what Jesus said? He said, ‘When you help the least of these you help me,”‘ Martin said. “No one else will help these people.”

Federal law requires local authorities to keep track of sex offenders, and Robinson grew concerned as he saw one notice after another about sex offenders moving to the same spot – Martin’s one-acre tract just outside Clanton, a town of about 8,700. They came from 28 of Alabama’s 67 counties and three states. All but 10 committed crimes against children, Robinson said, and 32 were convicted rapists, including Dark.

The law only affects Chilton County, where Martin’s refuge is located and where people were worried, Robinson said.

People like Debra Morrison, who lives beside the small, nondenominational church. Some of her windows look out at the campers. “I’m just glad it’s over,” she said, her young granddaughter at her side.