More than 500 people gathered in downtown Portland on Friday night to protest the deaths of two black men shot and killed by police in Louisiana and Minnesota this week.

The rally came amid the tense aftermath of a similar march in Dallas Thursday night that ended after a sniper shot 12 police officers, killing five, and wounded two civilians.

The Portland protest formed in Monument Square shortly after 7 p.m., marched to City Hall, where dozens of marchers lit candles, and then moved on to the Portland Police headquarters on Middle Street before returning to Monument Square as night fell.

Along the way they chanted “Black lives matter” and “No justice, no peace.” As the crowd filled the plaza in front of City Hall, the chant changed to “This is what democracy looks like.” Along the way, drivers honked in support, and the crowd picked up some people who obviously had planned on a night in the Old Port instead of a protest march.

The event was peaceful and police reported no problems among the marchers or those whose night on the town was interrupted for a few minutes. About 10 uniformed officers marched alongside the crowd filling the street, and a patrol car with lights on led the way along the route.

The protest was hastily organized on Wednesday night after a police officer in Minnesota shot a motorist, Philando Castile, in a traffic stop. That shooting came a day after another black man, Alton Sterling, was shot by police in Baton Rouge, Louisiana,

David Thete, 17, who had the idea to organize the protest, said he had expected 30 people to show up for an informal gathering, but as interest grew on social media, he asked Rachel Talbot Ross, the longtime president of the Portland branch of the NAACP, to help.

Ross contacted police and secured a permit, and Thete and Portland Police Chief Michael Sauschuck met for three hours Friday afternoon to go over the plans.

Sauschuck said police had no interest in interfering with the protest and just wanted to make sure the marchers were safe.

“We’re proud of our city, we’re proud of our community and we’re proud of these youths coming out to have their voices heard,” Sauschuck said.

Thete said the reason for the vigil expanded after the violence in Dallas Thursday night left the nation on edge. During a standoff before he was killled, the sniper, Micah Xavier Johnson, told police that he was upset over the police shootings of the two black men earlier in the week and was targeting white people, specifically police officers.

“We’re here for Philando Castile, Alton Sterling and the five policemen who were shot,” Thete said as the protest started.

And there would be no violence in Portland Friday, he told the crowd.

“There’s no negativity here, there’s no violence,” Thete said, and he told anyone who had other ideas they should leave.

Protests against police violence took place around the country Friday, as well as overseas, including in Little Rock, Arkansas; Los Angeles; Denver; Atlanta; New Orleans; Boston; Flint, Michigan; Omaha, Nebraska; Pittsburgh; Washington, D.C.; and London in the United Kingdom.

The officers slain in Dallas also were remembered Friday night at a vigil in Augusta, where policemen and civilians from around the state gathered at the Maine Law Enforcement Memorial in an event organized by the Augusta Police Department. Police from Bath, Falmouth, Waterville and Augusta, as well as deputies from Somerset and Kennebec counties and representatives from the Maine Warden Service and Fire Marshal’s Office, were among those who attended.

Kate Braestrup, chaplain for the Maine Warden Service, was among the speakers to offer comments and comfort to those at the vigil, many of whom held signs saying “Dallas Police Department.”

Braestrup, whose state trooper husband was killed in the line of duty, said that when she turned on the television to see the news of the sniper attack, she felt an overwhelming sense of grief and anger, but also an overwhelming sense of pride. “Those men, who are a part of my family, were running in to help.”

In Portland, the one somewhat ugly moment came in front of the police headquarters, when the crowd chanted, “No justice, no peace, no racist police.”

Organizers quickly shut the chant down.

“In the midst of people that are dying, we’re coming together as people – one people,” Anabiri Benjamin, 17, of Portland, told the crowd. “We have to come together as one and fight the system.”

Two people who joined the protest on the spur of the moment were Diane Warring of Portland and Jean Gallant of Scarborough.

They were watching as the marchers headed down Middle Street through the Old Port, when Warring saw her son-in-law and grandchild walking by.

Her son-in-law hadn’t told her of the protest or that he would be in it, she said, before hurrying to catch up.

Warring, who is white, said the increasing racial violence in the country makes her concerned for her grandson, who is black.

“Right now, he doesn’t know what prejudice is and the history,” she said. “I am worried for him.”

Kennebec Journal Staff Writers Charles Eichacker and Jessica Lowell contributed to this report.