A Northern California imam whose widely distributed sermon about Jews in disputed Jerusalem set off controversy and fear of violence apologized at a Friday news conference, saying his words were hurtful and “unacceptable.”

“To the Jewish community, here in Davis and beyond, I say this: I am deeply sorry for the pain that I have caused. The last thing I would do is intentionally hurt anyone, Muslim, Jewish or otherwise. It is not in my heart, nor does my religion allow it,” Ammar Shahin said in his statement.

Shahin spoke at a conference with other Muslim, Christian and Jewish leaders in Davis, a university community outside Sacramento. The mayor and a county supervisor also spoke there about the videotaped sermon, which was watched many thousands of times in the past few days since it was posted by Shahin’s mosque, the Islamic Center of Davis (ICD).

The imam preached last week about a controversy going on at the al-Aqsa Mosque compound in East Jerusalem, an intensely contested site that is considered holy by Jews and Muslims. Israeli officials had put metal detectors at the site for Muslims to pass through, days after Arab-Israeli gunmen shot and killed two Israeli guards at the site.

The standoff sparked a surge of deadly violence and protests in East Jerusalem, the West Bank and Jordan, which oversees the compound.

In the hour-long sermon, the 31-year-old Shahin focused on the standoff at the site and called Muslims to come together to protest the closure there. He prayed for God to destroy Muslims’ opponents at the site.

The Middle East Media Research Institute (MEMRI), which monitors media coverage, particularly about Israel, translated Shahin’s remarks as calling for God to “liberate the Al Aqsa Mosque from the filth of the Jews” and to “annihilate them down to the very last one,” the group said in a statement.

“Commitment to defending religious rights in Jerusalem should not cause division or fan the flames of anti-Semitism,” Shahin said at Friday’s news conference. “Today, I commit to working harder and will join efforts for mutual understanding and building bridges. As a young religious leader, this has humbled me.”

On Wednesday, Shahin told The Washington Post that he wasn’t speaking of Jews in general but “specifically about this group shutting down the mosque — these soldiers, or settlers, or fighters, or oppressors.” He said he had focused on the situation at al-Aqsa because so many U.S. Muslims aren’t aware of it. He said he regularly speaks out against the Islamic State and extremism by Muslims and has made statements against Muslim extremist attacks in Europe, South Asia and elsewhere.

“It’s unfair when I have spoken about nonviolence, and here is some two minutes. My record is very clear, I have always been against violence,” he said.

The YouTube clip of Shahin’s sermon has been watched more than 17,000 times since it was recorded July 21.

Worried about protests and even potential violence, Davis interfaith leaders, including Shahin, spent several days discussing how to publicly address the controversy, said Rabbi Seth Castleman, president of the regional board of rabbis.

Right after the sermon hit the Internet, the mosque put out two statements about it, accusing MEMRI of pulling a short clip out of context.

“In the context of the full sermon, it becomes clear that the theme of the sermon was against oppression, and not against Jews or any religion,” the mosque statement said. “If MEMRI and company sincerely followed Imam Ammar Shahin’s work and did not just cut and paste what suits their cause, they would have come across the countless lectures and sermons he has given regarding treating all people, especially non-Muslims, with kindness and giving them their full rights, supporting them when they are oppressed.”

An additional statement on the mosque’s YouTube channel said this:

“The ICD will always stand against anti-Semitism similarly to how the Jewish community has always stood against Islamophobia in our close-knit community. We have zero tolerance for anti-Semitism or any other form of bigotry.”

But local and national Muslim and Jewish leaders said they understood why some were alarmed by the sermon.

Hamza El-Nakhal, a longtime member of the Muslim community in Davis and a former president of the Islamic Center’s executive board, told the Davis Enterprise earlier this week that he found the video “disturbing.”

“While I am disgusted by the action of the Israeli government in preventing Muslim people from doing their prayers in the Masjid Al-Aqsa, I am equally disgusted by any religious leader who does not take the chance [during] high unsettling times to calm their congregations,” El-Nakhal told the Enterprise. “Some people like Imam Ammar Shahin become angry for injustices. He spoke while angry. He should not have given this sermon while angry.”

Basim Elkarra, executive director of the Sacramento chapter of the Council on American-Islamic Relations, or CAIR, said that the Jewish and Muslim communities in the area have a history of “strong relations.” He added, “Working together, we’ll get through this.”

Of the imam, he said it was essential for “people to realize words matter, words have consequences.”

Several national Jewish advocacy organizations spoke out against the sermon, including the Simon Wiesenthal Center and the Anti-Defamation League.

“These statements are anti-Semitic and dangerous. We reject attempts to cast the conflict in Jerusalem as a religious war between Jews and Muslims. At this time of heightened tension, it is more important than ever for the Jewish and Muslim communities to come together to condemn the use of stereotypes and conspiracy theories,” the ADL said in a statement Tuesday.

Nazir Harb Michel, a senior fellow at Georgetown University’s Center for Muslim-Christian Understanding in Arab and Islamic Studies, translated one passage in the imam’s sermon this way:

“O God, liberate the al-Aqsa mosque from the desecrations of the Jews. O God, upon you is the handling of those who closed the al-Aqsa mosque. O God, defeat each of them and count them all, and don’t leave any of them out.”

While Michel said the imam clearly used the word “Jews,” he felt that the context of the sermon, and even the paragraph, made it clear he was speaking about those involved in the conflict at al-Aqsa.

“I would question some of the choices he made to include oral traditions about Muslims fighting Jews and his generalizing and re-contextualizing…. The imam appears to have been very emotional in certain parts and probably did cross a line between talking about politics and talking about religion that would be offensive to many. Personally, I take issue with the spiritualizing of political conflicts on both sides of the situation,” said Michel, who also expressed concern that MEMRI was hoping to stir up anti-Muslim sentiment at a time when Muslim Americans feel under siege.

Castleman, the rabbi, said local leaders were terrified of violence breaking out.

“I told him, ‘It’s like marriage: You can be happy or right, but you can’t be both.’ This is the time for you to create happiness and not justify yourself to be right,” he said of Shahin. “Look, the Old and New Testaments have horrible things in them. You can always find horrible things. It’s a matter of how you apply them and how you use them.”

Davis officials earlier this year investigated as a hate crime an attack on Shahin’s mosque. Surveillance video showed a woman placing bacon, which Muslims are forbidden to eat, on a door handle of the building in the middle of the night. Also, a half-dozen windows were shattered, the Los Angeles Times reported.

Abigail Hauslohner contributed to this report.

Want more stories about faith? Follow Acts of Faith on Twitter or sign up for our newsletter.

Trump’s treatment of Sessions should alarm  his evangelical fans

Discrimination against Muslims increasing, poll finds

How ‘The Bachelorette’ showed millions a different side of the Sikh faith