Young people with mental illness often turn to drugs to treat themselves – but a new program is working to help them diagnose their problems early and find treatment, stopping homelessness before it starts.

Mental illness usually hits between the ages of 17 and 24 and can be compounded by illegal drug use, increasing the chances kids will end up on the street.

That's what happened to John, a 21-year-old who began experiencing sudden panic attacks in his late teens. His problems drove him to seek comfort in heroin and crystal meth. Eventually, his habit drove him from his home.

"I remember my dad and I fighting. He called me a junkie at Christmas and I left," he said.

On the streets of Vancouver, he had it even worse. "You're not safe, and you don't have any family and nobody cares about you," he said. "You fall asleep, people steal your stuff."

Covenant House is trying to intervene in cases like John's, offering youth on-site treatment for mental illness coordinated by two in-house clinicians and delivered by a team of doctors from St. Paul's Hospital.

"We see this as a really important prevention piece," Dr. Steve Mathias told CTV News. "Working with youth before they become so unwell that it's very difficult to house them, or impossible to house them."

At Covenant House, people like John can see a doctor in less than two weeks – compared to a six-month wait time outside.

"A youth can't wait six months when they're homeless. It's just too transient," Mathias said.

John says it was the quick intervention by Dr. Mathias that saved his life. "If I was not seeing him I probably wouldn't be alive today, to be honest," he said.

Now John is taking medication, he's back in high school and has big plans for his future – plans that don't involve going back to living on the streets.

With a report from CTV British Columbia's Jon Woodward