Washington (CNN) President Donald Trump tweeted his support for the Boston Police Department's handling of a self-described free speech rally and counterprotest march that brought thousands to the city's downtown Saturday, adding that he applauded "the many protestors in Boston who are speaking out against bigotry and hate."

"Looks like many anti-police agitators in Boston," Trump tweeted about two hours after the largely peaceful rally and march there ended. "Police are looking tough and smart! Thank you."

Later, Trump tweeted that the protests might help heal decades-old divisions.

"Our great country has been divided for decades," he wrote. "Sometimes you need protest in order to heal, & we will heal, & be stronger than ever before!"

"I want to applaud the many protestors in Boston who are speaking out against bigotry and hate," he continued. "Our country will soon come together as one!"

The Boston Police Department arrested 27 people during Saturday's protests, Police Commissioner William Evans said in a press conference. Most of the arrests were for disorderly conduct, but a few individuals were arrested for assaulting police officers, he added.

The rally, which was planned before racially motivated protests in Charlottesville, Virginia, turned deadly last week, took place amid a heated national debate about racism and the future of Confederate monuments -- but the Boston march and rally were largely peaceful

In Charlottesville, white supremacist groups rallied against the city's plan to take down a statue of Confederate Gen. Robert E. Lee, a protest that exploded in violence that resulted in the death of 32-year-old counterprotester Heather Heyer. Two Virginia state troopers, Jay Cullen and Berke Bates, were killed as well in a helicopter crash during the response to the violence.

In Boston, rally organizers had invited "libertarians, conservatives, traditionalists, classical liberals, Trump supporters or anyone else who enjoys their right to free speech," according to a group calling itself the Boston Free Speech Coalition, which sought to distance itself from the violence in Charlottesville on its Facebook page.

"We denounce the politics of supremacy and violence," it said. "We denounce the actions, activities, and tactics of the so-called Antifa movement. We denounce the normalization of political violence."

A coalition of mostly left-leaning groups and activists such as the Black Lives Matter movement organized Boston's counterprotest.

Some carried signs with messages such as "No Trump. No KKK. No racist USA" and "Americans against hate." At times, they chanted "Hey hey, ho ho, white supremacy has got to go" and "black lives matter."

Police maintained a buffer zone between marchers and rally participants -- averting major incidents except for occasional clashes and shouting matches between the counterprotesters and supporters of Trump.

Earlier in the week, Trump held a news conference in which he blamed the violence in Charlottesville on both sides of the conflict -- equating the white supremacists on one side with the "alt-left" on the other side.

On Saturday, after the Boston rally and protest march ended, Trump tweeted thanks and "great job" to Boston Mayor Marty Walsh.

Walsh tweeted earlier Saturday morning asking for peace and respect at Saturday's "Free Speech" rally and counter-protests.

"I ask everyone to be peaceful today and respect our City," he wrote. "Love, not hate. We stand together against intolerance."

By 1:30 p.m., the rally had ended, earlier than expected. "'Free Speech' rally is officially over," the Boston police tweeted. "Demonstrators have left the Common."