(Reuters) - Dozens of people were arrested on Tuesday outside the Minnesota governor's mansion amid a weeks-long protest over the police killing of a black motorist earlier this month.

At least 46 protesters were arrested throughout the day, with about half being arrested around 7 p.m. for public nuisance and unlawful assembly, the St. Paul Police Department said in a statement.

"The people were arrested after being told to disperse and stop blocking the sidewalk," the statement said.

Demonstrators have been protesting outside Governor Mark Dayton's residence since the fatal July 6 shooting of 32-year-old Philando Castile. His girlfriend posted live video on the internet of the bloody scene minutes afterward, which was widely viewed and sparked anger.

Castile's killing occurred within a day of the shooting of 37-year-old Alton Sterling in Baton Rouge, Louisiana. Sterling was killed during an altercation with two white police officers. Graphic video of that incident caused an outcry on social media.

The two killings were the latest in a stream of fatal police encounters with blacks over the past two years that fueled the Black Lives Matter movement.

St. Paul police said officers around 7 a.m. told demonstrators camped out in tents in front of the mansion that they could not block the streets or sidewalk. Many agreed to leave with their belongings.

Police said some of the remaining protesters then walked into the street and were arrested for blocking traffic. About 12 hours after the incident began, officers arrested 19 more people.

Protester Jacob Ladda told the local Star Tribune newspaper that police were "asking us to remove water and food from the space — tents and other things that provide shade. They're using intimidation tactics rather than legal tactics."

(Reporting by Curtis Skinner in San Francisco; Editing by Peter Cooney)