Oregon's governor has said the federal government agreed to withdraw agents from Portland but the Department of Homeland Security said it would keep officers there until it was certain federal properties would not be attacked.
Governor Kate Brown said the government agreed to a phased withdrawal of federal officers deployed at Portland's Mark Hatfield United States Courthouse after weeks of clashes between activists and agents.
"Beginning Thursday, all Customs and Border Protection and ICE officers will leave downtown Portland, and shortly thereafter will begin going home," Ms Brown said in a statement.
The US Department of Homeland Security said it had agreed on a joint plan to end the violence in which state and local law enforcement would begin to secure areas around federal properties and it would change its "force posture" should conditions significantly improve.
"The department will continue to maintain our current, augmented federal law enforcement personnel in Portland until we are assured that the Hatfield Federal Courthouse and other federal properties will no longer be attacked and that the seat of justice in Portland will remain secure," DHS Acting Secretary Chad Wolf said in a statement.
Protesters' anger over Trump's planned 'surge' of federal troops
UN rights body urges US to rein in police at protests
New York Mayor says he would sue if Trump sends federal troops into the city
Republican President Donald Trump, seeking re-election in November, has sought to crack down on protests to highlight his focus on law and order amid unrest across the country after the 25 May killing of a Black man, George Floyd, by Minneapolis police.
The federal government deployed teams of tactical agents to Portland in early July to defend the courthouse, drawing criticism from Democrats and civil liberties groups who alleged excessive force and federal overreach by Mr Trump.
Ms Brown and Portland Mayor Ted Wheeler, both Democrats, complained they never asked for the federal officers and their presence was worsening the situation with protesters.
Solidarity protests spread over the weekend to other US cities, prompting complaints by Democratic mayors that illegal federal deployments were escalating tensions across the country.
Seattle Mayor Jenny Durkan said US Border Patrol Tactical Unit officers had withdrawn from her city.
In parallel with the contested crackdown in Portland, the administration has sent in federal agents to supplement local law enforcement in several US cities facing a rise in gun crime: Chicago, Kansas City and Albuquerque - compounding public anger over the situation in Portland.
Today's announcement on Portland came as President Trump's administration said it was expanding the controversial "surge" of federal agents to three more US cities - Cleveland, Detroit and Milwaukee.
In a statement, Attorney General Bill Barr said all three Democratic-run cities "have seen disturbing increases in violent crime, particularly homicides".
As part of so-called "Operation Legend," just under 100 agents will head to the three Great Lakes cities, according to the Justice Department, which said homicides were up 13% in Cleveland, 31% in Detroit and 85% in Milwaukee since the start of the year.