SALT LAKE CITY — When J.D. Goates was 17 and newly graduated from high school, he decided that he had had enough.

His thoughts of suicide, which had begun when he was 8, had become stronger. He was ashamed of being bisexual, especially because his Mormon church told him that homosexuality was abhorrent. His classmates and even his teachers in northern Utah heaped scorn on people like him. When he came out to people he thought were his friends, he was crushed by the hostility of some of them. With both his parents away on business trips, he tried to take his life.

“I thought, ‘If I’m going through this hell now, is there a greater reason for all of this?’” Goates said. “And I came to the decision that there wasn’t.”

Goates’ suicide attempt failed, and now he is a 23-year-old senior at Brigham Young University. But many young people in Utah and across the country haven’t survived.

Between 2006 and 2014, the suicide rate among Americans 19 and under rose from 2.18 to 2.75 per 100,000 people. At least 36 states have experienced an increase, but the problem is especially dire in Utah, where the suicide rate rose from 2.87 to 6.83 during that period.

Among the possible causes cited by suicide experts is a decline in the use of psychiatric medicines and the rise of cyberbullying. Whatever the reasons, a number of states, over the past five years, have adopted measures to try to reverse the trend.

In Texas, for example, a 2015 law requires the state health department to identify and publicize the best practices used in all states for suicide prevention. All public school teachers, counselors and principals in the state must receive training in how to recognize and address signs of suicide risk in students, and schools must notify parents if there’s a concern their child might be at risk for suicide.

New York established an office to coordinate all state suicide prevention activities. The state also provides extensive training for teachers and staff, as well as student peer groups, in how to identify children who seem to be in distress and direct them to adults who can connect them to mental health services. Last month, Wyoming established a statewide crisis text line for residents considering taking their own lives, especially teens.

And most states now deploy suicide response teams to schools where a student has committed suicide. Research has shown that publicity surrounding a suicide can prompt others, particularly young people, to take their own lives.

“You have to do everything to prevent contagion,” said Greg Hudnall, who created a program that trains Utah students to recognize classmates who seem isolated or depressed and direct them to help or tip off counselors or teachers.

It’s one of several steps Utah has taken since 2012 to try to stem the tragedies, including mandatory suicide prevention training for teachers and parents and similar outreach to pediatricians, coaches and others who interact with young people.

“For Utah, more has happened on the suicide prevention front in the last three years than in the 20 years before that,” said Doug Gray, a psychiatrist at the University of Utah who has studied suicide for more than two decades.

While the numbers continue to rise, Gray and others think the prevention efforts are making a difference. But some suicide experts and advocates for children think certain factors in Utah forestall more effective youth suicide prevention efforts.

The state has few restrictions on gun ownership, which suicide experts link to higher rates of suicide, and it has resisted expanding Medicaid eligibility, which critics say would make mental health services more available to those at risk for suicide. Utah also restricts discussion of homosexuality in the classrooms, which gay rights advocates argue further stigmatizes gay students, who are already more vulnerable to suicidal impulses.

Youth suicide declined in the 1990s, which many suicide researchers attribute to the growing use of antidepressants. But that trend came to an abrupt end in the mid-2000s, when the youth suicide rate began its upward trajectory.

Suicide rates are much higher among older Americans than they are among teens: For every 100,000 people, in 2014, there were 19.4 suicides among 40- to 59-year-olds, compared with 2.75 among those 19 and younger.

Some suicide experts, like Gray, associate the rise with the U.S. Food and Drug Administration’s warnings, starting in 2003, that the use of antidepressants may increase the risk of suicide in teens and adolescents.

The warning, Gray said, persuaded many pediatricians and family practitioners to stop prescribing the drugs to their young patients with depression. Some studies have linked higher rates of teen suicide to the decreased prescribing of antidepressants.

There may be other factors at work in Utah. Studies have found higher suicide rates in areas with low population, where people are more likely to be depressed and mental health services may be less accessible. Utah public schools are barred by law from “advocating homosexuality,” which, critics say, discourages any candid conversation on the subject.

Those “laws exacerbate the stigma that LGBTQ students experience,” said Troy Williams, executive director of Utah Equality, a gay rights organization.

The state does not track suicides by sexual orientation. Like all states, Utah periodically asks students whether they have considered suicide or made attempts, as well as if they take drugs, use alcohol, smoke cigarettes or are sexually active. Starting next year, those surveys will include questions about sexual orientation.

Some child and gay rights advocates say the Mormon church, which dominates the state’s culture, and its doctrinal objection to homosexuality, cause deep distress to young gay people, like Goates, who see themselves as outcasts who will fail to live up to the ideals of their church of marrying and having large families.

“The church is essentially telling gay youngsters, you are outsiders and will always be outsiders,” said Terry Haven, deputy director of Voices for Utah Children, a child advocacy nonprofit. “Of course there will be consequences from that message.”

A spokeswoman for the church, Kristen Howey, declined to address the question of whether the church’s views on homosexuality contribute to the greater suicide risk among LGBTQ youth. But she called suicide “tragic, no matter the explanation or circumstances.”

“We are concerned about the physical, emotional and mental challenges our members face, and the church is actively pursuing ways to help, including online resources and local leader training,” Howey said. “We invite youth, parents, friends and church leaders to take action to become informed on this subject, and we encourage communities to continue to partner on prevention and intervention.”

But the Mormon church has not become less tolerant of homosexuality in recent years and none of the other explanations account for the steep increase in youth suicides in Utah since 2006. State officials admit they are confounded.

The best guess, state officials say, is an increase in cyberbullying and increased computer screen time, which some suicide experts hypothesize is either a symptom of increased isolation or a cause of it.