Addressing his congregation on the Eid al-Fitr holiday celebrating the end of Ramadan, Imam Mohamed Abdul-Azeez implored worshipers to combat Muslim extremism in the aftermath of a shooting rampage that killed five servicemen in Tennessee.
The suspect, a young Muslim who grew up in the Chattanooga area, also died in the gunfight on Thursday, the last day of Islam's holy month of fasting.
It was the latest reminder to American Muslims of the need to find ways to keep teenagers and young adults from being drawn to ideologies promoted by such groups as Islamic State, the militants also known as ISIS who control part of Syria.
"When they talk about Syria, when they talk about Tennessee ... what will they say about the American Muslim community?" Azeez asked the 2,000 congregants at the rented hall in Sacramento, California, on Friday.
He went on to rail against extremists, whom he said usurp the spirit of Allah for their own purposes.
The FBI is investigating the Chattanooga shooting as an act of terrorism, though law enforcement officials said it was premature to speculate on the gunman's motive.
Hours before the attack, the suspect, Mohammod Youssuf Abdulazeez, had texted his close friend a link to a long Islamic verse that included the line: "Whosoever shows enmity to a friend of Mine, then I have declared war against him."
Mainstream Muslim leaders around the world are concerned about the radicalization of young people, vulnerable to fiery rhetoric that frequently distorts the religion's true teaching.
In Britain, a well-known cleric developed a 900-page anti-extremism religious curriculum to be taught in Muslim schools. About 700 Britons are estimated to have traveled to Syria and Iraq, many to join ISIS.
In the United States, imams and other leaders regularly visit high schools and colleges, but finding the right message and approach has proved to be a delicate tightrope walk between religion and politics.
In Chicago, anti-extremist activist Ahmed Rehab lectures at schools and mosques, rebutting radical ideas point by point with Islamic theology. He said militant groups at best misread the Koran and at worst distort it when they say that Islam condones their violent behavior.
"When we're able to root our arguments that are counter-extremist in the authentic message of Islam, I think it's more effective," Rehab said.
Yasir Qadhi, a professor at Rhodes College in Memphis, Tennessee, and the AlMaghrib Institute educational organization, also emphasizes religious teachings to show that Islam condemns terrorism. But he goes step further, engaging his students in discussions of political issues facing Muslims in the United States and elsewhere, even though that can invite controversy.
"Simple condemnations are not going to get to the hearts and minds of these people," Qadhi said. It is important to acknowledge that young people are attracted to groups like ISIS because they are seen as standing up for oppressed Muslims, he said.
The cleric recognizes that his listeners may feel angry about Israeli-Palestinian relations or other flashpoint issues. He said he uses history and theology to combat extremism.
It's a stance that has earned Qadhi death threats from ISIS as well as some far-right Americans, with both sides saying he is too sympathetic to the other.
In Sacramento, Muslim leaders educate young people about broader social issues, including poverty, access to healthcare and racism, said Basim Elkarra, executive director of the Sacramento Valley chapter of the Council on American-Islamic Relations.
Through a leadership program run in cooperation with the state legislature, high school students learn about political engagement, such as lobbying, drafting legislation and what it's like to serve as an elected official.
"It's giving people an outlet," Elkarra said, "giving them a voice and the tools to make a difference."
Sacramento Muslims have also set up a hotline for people to call if they become anxious or stressed, said Irfan Haq, president of the Council of Sacramento Islamic Organizations.
A key problem, several imams said, is that people who become radicalized tend to stop coming to their mosques, preferring instead the company of militant recruiters and radical clerics.
In Arizona, for example, leaders at the Islamic Community Center of Phoenix knew Elton Simpson, one of two men killed by police while attempting an attack at an anti-Islam event near Dallas in May. Simpson had argued with the mosque's imam over teachings he perceived as too liberal.
Then he disappeared.
"It doesn't match with the ideology and they stop coming," said Usama Shami, chairman of the Islamic Community Center of Phoenix. "And then you don't know what they are doing."