Kevin Foley stood before a judge in Broward County’s drug court — fellow abusers sitting behind in him in the pews — talking about the fitful life of a recovering addict, the random drug tests, the counseling and what he hoped was his next, clean chapter.

Foley, 21, has been hooked on heroin for nearly two years. Before that, he was popping oxycodone and other prescription pills snapped up as Florida become a bustling marketplace of illegal pill mills. He turned to heroin after his drug of choice became too expensive. “I was chasing the next high,’’ says Foley, who landed in drug court after a heroin possession arrest in December. “I wanted to try it all.”

Heroin is inching back in Florida, the unintended consequence of the state’s epic war on prescription pills. Now, with Florida officials successfully slowing the supplies, shutting down the pill mills that masqueraded as pain centers and arresting thousands of addicts and even doctors, heroin has become a popular substitute.