Los Angeles County Sheriff Alex Villanueva took part in a community dialogue with Pastor Noel Jones at the City of Refuge Church Sunday afternoon, less than a day after two deputies were ambushed while sitting inside their patrol vehicle.

The community dialogue, which had been scheduled more than a week before Saturday night's ambush touched upon the issue of trust between minority communities and law enforcement amid nationwide protests against police brutality and racial injustice.

Pastor Jones acknowledged that a lot of the mistrust stems from both parties not having an accurate perception of the other side.

“Each individual has to be assessed in terms of who they are, what they do, how they behave, and not just grouped with the rest of those who don’t operate properly,” Jones said. “The truth of our community is that everybody is not a criminal. And the truth of law enforcement is that everybody there is not abusive.”

He added: “We have to face that there are criminal elements in law enforcement. And we still have to face that there are criminal elements in our community. And we have to police internally.”

Villanueva appeared to agree with Jones’ point, adding that a lot of the unrest sweeping the country could be quelled by not rushing to judgement.

“Instead of taking apart and demonizing, let’s spend our energy understanding,” the sheriff said. “And when we start understanding, or making the effort to understand we start realizing, ‘Oh wow, there are lot more perspectives out there than what I initially assumed.”

A screen grab from a security camera video released the Los Angeles County Sheriff's Department shows a gunman walking up to sheriff's deputies and opening fire without warning or provocation in Compton, Calif. (Los Angeles County Sheriff's Department via AP)

The discussion came less than 24 hours after two deputies, a 31-year-old female and a 24-year-old male, were sitting in their squad car at a Metro rail station in Compton when a suspect walked up and opened fire through an open window on the passenger side. The deputies were able to radio for help.

The department tweeted a video of the shooting that shows a person opening fire with a pistol. The incident happened around 7 p.m. a short distance from the Compton sheriff's station south of downtown Los Angeles.

"The gunman walked up on the deputies and opened fire without warning or provocation," the department stated.

Sheriff Villanueva said in a late-night news conference that both deputies underwent surgery Saturday evening. Both graduated from the academy 14 months ago, he said.

A spokeswoman for the sheriff's department on Sunday described the deputies' situation to Fox News as "critical."

BIDEN CALLS AMBUSH OF LA DEPUTIES 'UNCONSCIONABLE,' TRUMP FLOATS DEATH PENALTY IF OFFICERS DIE

Villanueva, whose department has been criticized during recent protests over racial unrest, expressed frustration over anti-police sentiment as he urged people to pray for the deputies.

"It pisses me off. It dismays me at the same time," he said.

A handful of protesters gathered outside the hospital where the injured deputies were being treated. The protesters tried to provoke deputies stationed outside and at one point were prevented from entering the emergency room, Bishop Juan Carlos Mendez with the Churches in Action group told the TV station KABC.

"Unacceptable behavior. The hospital should be a sanctuary, we should leave hospitals alone," he said. Mendez and members of his group gathered nearby in prayer for the wounded deputies.

"To the protesters blocking the entrance & exit of the HOSPITAL EMERGENCY ROOM yelling "We hope they die" referring to 2 LA Sheriff's ambushed today in #Compton: DO NOT BLOCK EMERGENCY ENTRIES & EXITS TO THE HOSPITAL," the sheriff's department tweeted. "People's lives are at stake when ambulances can't get through."

Meanwhile, the search for the gunman continued through Sunday. Capt. Kent Wegener said officers were blanketing the area in search of the suspect.

"We have a very, very generic description," he said.

The U.S. Justice Department will assist sheriff's investigators with "all federal tools available," spokeswoman Kerri Kupec said on Twitter.

CLICK HERE TO GET THE FOX NEWS APP

Protesters have railed against the LA Sheriff's Department for weeks over recent shootings by deputies, including the killing of a man on a bicycle last month.

"Of course, there's an important conversation going on about policing in this country, but these are folks who put their lives on the line for us, and we will find justice for them," Los Angeles Mayor Eric Garcetti said on CNN Sunday.

The Associated Press contributed to this report.