BOSTON — Police officers swept through Dewey Square early Saturday, tearing down tents at the Occupy Boston encampment and arresting dozens of protesters, bringing an end to the 10-week demonstration.

Officers began moving into the encampment about 5 a.m. to “ensure compliance with the trespassing law,” police spokeswoman Elaine Driscoll said.

The city had set a deadline for midnight Thursday for the protesters to abandon the site but police took no action until early Saturday, making Boston the latest city where officials moved to oust protesters demonstrating against what they call corporate greed and economic injustice.

As police moved in, about two dozen demonstrators linked arms and sat down in nonviolent protest and officers soon began arresting them. The protesters were “very accommodating” to the officers, Driscoll said. Forty-six people were arrested on charges of trespassing and disorderly conduct, police said. No injuries were reported. The entire operation lasted less than an hour.

“In the interest of public safety, we had to act,” Mayor Thomas Menino said. While Menino previously had said the city had no plans to forcibly remove the encampment, he issued his ultimatum after a judge ruled on Wednesday that the protesters had no right to stay in Dewey Square.

Occupy Boston said that, although its space was gone, the movement would continue. The group planned to meet Saturday evening in Boston Common.

“We might have been evicted, but we shall not be moved,” the group said on its website Saturday. “We remain invested in the future of our movement. We will continue to challenge Wall Street’s occupation of our government.”

On Saturday afternoon, Dewey Square was blocked off by metal barricades, and about 15 police officers were stationed at points around the small park as workers aerated the compacted soil, spread new soil and prepared to lay turfgrass, probably by early next week.

Protesters estimate that 100 to 150 activists lived in the Boston encampment. Demonstrators were forcibly removed from similar encampments in New York City, Los Angeles, Philadelphia and San Francisco.