A rally here by the Ku Klux Klan and its supporters to protest the Charlottesville City Council’s decision to remove a statue honoring Confederate Gen. Robert E. Lee encountered a loud and angry counterprotest Saturday afternoon.

Members of the Loyal White Knights of the Ku Klux Klan, which is based in Pelham, N.C., near the Virginia border, gathered at Justice Park, situated in a quiet, leafy residential neighborhood in downtown Charlottesville. They shouted “white power,” and some wore white robes.

About 30 Klansmen were escorted to and from the rally by police in riot gear who were out on a hot day to separate the rallygoers and approximately 1,000 counterprotesters who greeted them with jeers. Attempts by Klan leaders to address the crowd were repeatedly drowned out by boos and chants. Some of the Klan members arrived armed, carrying handguns in holsters at their belts.

[KKK marchers say they will be armed Saturday at Charlottesville rally]

The rally was held about a block away from Emancipation Park — the renamed Lee Park — where the statue of Lee astride a horse still stands. Charlottesville police reported that vandals had painted messages in green and red paint on the statue overnight.

A statue of Robert E. Lee collects snow in Lee Park as snow falls on Monday, March 3, 2014 in Charlottesville, Va. (Ryan M. Kelly/AP)

More than 100 officers from the Virginia State Police, Albemarle County police and University of Virginia police were prepared to assist Charlottesville police in maintaining order.

After the Klan rally ended, police led several people away in handcuffs after a large group of counterprotesters remained near the vicinity of the park. Police asked those still gathered nearby to disperse. Wearing riot gear and gas masks, the police declared the counterprotesters “an unlawful assembly” and used gas canisters to compel them to leave the area.

Police said Sunday that 22 people were arrested. Authorities said three people were hospitalized; two for heat related issues and one for an alcohol related issue.

“I was pleased with the professionalism and commitment of our law enforcement partners as our safety plan was well executed. Officers traveled from near and far to assist the CPD in maintaining law and order during this difficult endeavor,” Charlottesville Police Chief Al Thomas said Sunday.

“Hundreds of local citizens rose up in a non-violent protest against the hate that was being spewed in Justice Park,” Thomas said in a statement. “When Klan members arrived, the atmosphere quickly became emotionally charged. Several outside groups made it clear they would become confrontational; however, we were prepared for the unrest that occurred near the conclusion of the event which unfortunately resulted in a number of arrests. Order was quickly restored and our community remains safe.”

Charlottesville, a city of close to 50,000 and home to the prestigious public flagship campus of the University of Virginia, had become increasingly tense as the rally approached. “A CITY ON EDGE” read the front-page headline in the local paper, the Daily Progress, on Saturday.

[White nationalist Richard Spencer leads torch-bearing protesters defending Lee statue]

1 of 18 Full Screen Autoplay Close Skip Ad × Photos from the scene of a Ku Klux Klan rally and counterprotest in Charlottesville, Va. View Photos Klansmen were escorted to and from a rally by police in riot gear to protect them from about 1,000 counterprotesters who greeted them with jeers of “shame.” The rally was held to protest the city’s decision this year to remove a statue of Confederate Gen. Robert E. Lee from a public park and rename that park. Caption Klansmen arriving and departing from the rally were escorted by police in riot gear to protect them from about 1,000 counterprotesters, who greeted them with jeers of “Shame!” The rally was held to protest the city’s decision this year to remove a statue of Confederate Gen. Robert E. Lee from a public park and rename that park. July 8, 2017 Members of the Ku Klux Klan arrive for a rally in Charlottesville, Va., to protest the planned removal of a statue of General Robert E. Lee. Andrew Caballero-Reynolds/AFP/Getty Images Buy Photo Wait 1 second to continue.

City leaders organized diversionary events elsewhere in the city and encouraged residents and visitors not to confront the KKK members directly. While many took that advice, others wanted to make sure the rally participants heard their voices.

“It is important for me to be here because the Klan was ignored in the 1920s, and they metastasized,” said Jalane Schmidt, a professor at the University of Virginia who has been among those leading the call for the Lee statue removal. “They need to know that their ideology is not acceptable.”

“I teach about slavery and African American history, and it’s important to face the Klan and to face the demons of our collective history and our original sin of slavery. We do it on behalf of our ancestors who were terrorized by them.”

Though the council voted to remove the statue, a court order has stopped the city from acting on that decision until a hearing next month. Some observers predict a protracted legal battle that would further delay the removal.

In an editorial last month, city councilwoman Kristin Szakos said the council voted to remove the statue and join a “growing group of cities around the nation that have decided that they no longer want to give pride of place to tributes to the Confederate Lost Cause erected in the early part of the 20th century.”

[The Ku Klux Klan was dead. The first Hollywood blockbuster revived it.]

The Klan says the city’s decision to remove the Lee statue is part of a wider effort to get rid of white history.

“They’re trying to erase the white culture right out of the history books,” Klan member James Moore said Thursday.

Brandi Fisher, of Ridgeley, W.Va., drove hours to attend the rally.

“I don’t agree with everything the Klan believes, but I do believe our history should not be taken away,” said Fisher, 41. “Are we going to remove the Washington and Jefferson memorials because they were slave owners?”

Ezra Israel, 32, who is African American, says the statue should stay up as a reminder of slavery and the people who supported it.

“It’s hiding history to take it down,” he said as he made his way to the rally. “We need to leave it up so people can see it and see that we were oppressed and we’re still a product of that today.”

Toung Nguyen, an immigrant from Vietnam who moved to Charlottesville as a child in the early 1980s, said he believes the money that will be spent on removing the statue could be better used improving the local school system. But he says racism has gotten worse in the last couple of years and he understands why many believe the statue needs to go.

“It’s just disappointing that we still have to deal with this kind of nonsense,” Nguyen said. “Our country feels like it’s going full circle.”

Charlottesville is already planning for another protest next month. Several white nationalist groups have a permit for an Aug. 12 rally also calling for the council’s decision on the statue to be reversed.

T. Rees Shapiro contributed to this report.