Boston police are halting the use of one-officer patrols in the aftermath of the violence in Dallas.

Police said in a statement that two officers will ride together in every patrol car in the city as a precaution "in the best interests of officer safety."

The change was to remain in place at least through Friday.

On Thursday night, police officers were attacked while patrolling a protest in downtown Dallas. Five officers were fatally shot, and several others were wounded.

Boston Mayor Marty Walsh said his prayers are with those affected by the Dallas killings.

He said one of the biggest concerns is the threat of copycat attacks.

"Obviously our concern would be like in terrorist attacks — and this is a terrorist attack — and in terrorist attacks, you always worry about the copycat scenario, and that's what the Boston Police Department [has] to watch out for today and not only in Boston, all across the country," Walsh said.

Boston police said all flags on department facilities would be lowered to half-staff. Gov. Charlie Baker also ordered the U.S. and Massachusetts flags to be lowered to half-staff at all state buildings.

Baker said the flags will remain lowered for five days — "in honor of the five fallen officers in Dallas."

In a statement, Baker called the attack "a senseless and heinous crime against our brave first responders who put their lives at risk every day to keep our communities safe."

The Republican added in his statement that his "heart breaks for the families and loved ones of the innocent who lost their lives this week in Minnesota, Louisiana and Texas and I hope our nation can come together after a tumultuous and difficult period for so many across the country."

The Rev. Willie Bodrick of the Twelfth Baptist Church in Roxbury speaks at a prayer rally Friday. (Jesse Costa/WBUR)

Local activists are holding events throughout the weekend to reflect and discuss this week's deadly shootings in Louisiana, Minnesota and Texas.

Members of the local Black Lives Matter movement are set to gather in the South End Friday night for what organizers call a "healing event." With music and poetry, it's meant to give members of Boston's black community a space to process the recent incidents.

"To come together to heal, to mourn, to celebrate the fact that we’re still here, we're still resisting and to talk about what our next steps are," Daunasia Yancey, of Black Lives Matter Boston, told WBUR.

Earlier Friday, interfaith religious leaders gathered to pray at the Twelfth Baptist Church, in Roxbury. They included the Rev. Jeffrey Brown, the Rev. Laura Everett, executive director of the Massachusetts Council of Churches, and the Rev. Nancy Taylor, of Boston's Old South Church.

With reporting by WBUR's Zeninjor Enwemeka, Fred Thys and Delores Handy and The Associated Press