Counterprotesters marched through the city to historic Boston Common, where many gathered near a bandstand abandoned early by conservatives who had planned to deliver a series of speeches. Police vans later escorted the conservatives out of the area, and angry counterprotesters scuffled with armed officers trying to maintain order.
Members of the Black Lives Matter movement later protested on the Common, where a Confederate flag was burned and protesters pounded on the sides of a police vehicle.
Later Saturday afternoon, Boston's police department tweeted that protesters were throwing bottles, urine and rocks at them and asked people publicly to refrain from doing so.
Boston Commissioner William Evans said 27 arrests were made - mostly for disorderly conduct while some were for assaulting police officers. Officials said the rallies drew about 40,000 people.
Trump applauded the people in Boston who he said were "speaking out" against bigotry and hate. Trump added in a Twitter message that "Our country will soon come together as one!"
Organizers of the event, which had been billed as a "Free Speech Rally," had publicly distanced themselves from the neo-Nazis, white supremacists and others who fomented violence in Charlottesville on Aug. 12. A woman was killed at that Unite the Right rally, and many others were injured, when a car plowed into counterdemonstrators.
Opponents feared that white nationalists might show up in Boston anyway, raising the specter of ugly confrontations in the first potentially large and racially charged gathering in a major U.S. city since Charlottesville.
One of the planned speakers of the conservative activist rally said the event "fell apart."
Congressional candidate Samson Racioppi, who was among several slated to speak, told WCVB-TV that he didn't realize "how unplanned of an event it was going to be."
Some counterprotesters dressed entirely in black and wore bandannas over their faces. They chanted anti-Nazi and anti-fascism slogans, and waved signs that said: "Make Nazis Afraid Again," ''Love your neighbor," ''Resist fascism" and "Hate never made U.S. great." Others carried a large banner that read: "SMASH WHITE SUPREMACY."
Chris Hood, a free speech rally attendee from Dorchester, said people were unfairly making it seem like the rally was going to be "a white supremacist Klan rally."
"That was never the intention," he said. "We've only come here to promote free speech on college campuses, free speech on social media for conservative, right-wing speakers. And we have no intention of violence."
Rockeem Robinson, a youth counselor from Cambridge, said he joined the counterprotest to "show support for the black community and for all minority communities."
TV cameras showed a group of boisterous counterprotesters on the Common chasing a man with a Trump campaign banner and cap, shouting and swearing at him. But other counterprotesters intervened and helped the man safely over a fence into the area where the conservative rally was to be staged. Black-clad counterprotesters also grabbed an American flag out of an elderly woman's hands, and she stumbled and fell to the ground.
Saturday's showdown was mostly peaceable, and after demonstrators dispersed, a picnic atmosphere took over with stragglers tossing beach balls, banging on bongo drums and playing reggae music.
The Boston Free Speech Coalition, which organized the event, said it has nothing to do with white nationalism or racism and its group is not affiliated with the Charlottesville rally organizers in any way.
Rallies in other cities around the country each attracted hundreds of people showing their opposition to white supremacist groups.
Counterprotesters marched through New Orleans, some of them carrying signs that read "White People Against White Supremacy" and "Black Lives Matter."
In Atlanta, a diverse crowd marched from the city's downtown to the home of the late Rev. Martin Luther King Jr. Meredith Dubé brought along her two daughters, 2-year-old Willow Dubé and 12-year-old Rai Chin. Dubé is white and her daughters are mixed race. She said it is essential to show children at an early age that love is more powerful than hate.
An anti-racism rally was held in Laguna Beach, California, one day before the group America First! planned to hold a demonstration in the same place that's being billed as an "Electric Vigil for the Victims of Illegals and Refugees."
Mayor Toni Iselman told the crowd that "Laguna Beach doesn't tolerate diversity, we embrace diversity."
In Dallas, a large crowd attending a rally against white supremacy on Saturday evening called for the city to take down the city's Confederate statues.
"Now is the time to do what is right in the city of Dallas," said the Rev. Michael W. Waters who addressed the group at City Hall Plaza, a short distance from the city's Confederate War Memorial. "Now is the time to bring these monuments down."
Police officers on horseback moved in to break up a scuffle between people at the rally and supporters of Confederate monuments.
Police officers on horseback monitored the situation, and a police helicopter circulated above.
Copyright 2017 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.