Washington CNN  — 

The Trump administration has reached an agreement with Oregon’s Democratic governor to withdraw federal officers from downtown Portland, though the Department of Homeland Security says it will maintain a presence in the city until it believes federal locations there are secure.

The decision to send federal agents into Portland earlier this month escalated tensions in the city, which has seen prolonged and at times violent protests for the past two months over demands for racial justice and police accountability. President Donald Trump and acting Homeland Security Secretary Chad Wolf have said the federal officers were there to protect a federal courthouse in the city’s downtown that has been a focal point for protesters, but the officers have also clashed with demonstrators.

Wednesday’s agreement was announced separately by Gov. Kate Brown and Wolf, who offered different reports on the conditions for the agents’ withdrawal.

Federal officers from Customs and Border Protection and Immigration and Customs Enforcement, both of which are part of DHS, are set to leave the city’s downtown Thursday, Brown said in a statement. Brown noted some federal officers, including ones from the US Marshals Service and the Federal Protective Service, will stay at the courthouse since they are usually there.

“The federal government has agreed to withdraw federal officers from Portland. They have acted as an occupying force & brought violence,” tweeted Brown, who said the administration’s agreement to withdraw officers came after she had a discussion about the matter with Vice President Mike Pence.

Wolf, however, said late Wednesday morning that Oregon State Police “will coordinate” with federal authorities to ensure the protection of federal facilities, such as the courthouse, but conditioned a decrease in federal agents in Portland on both the state and the city’s ability to protect federal facilities.

“Our entire law enforcement presence that is currently in Portland yesterday and the previous week will remain Portland until we are assured that the courthouse and other federal facilities will no longer be attacked nightly and set afire,” he later told reporters.

“DHS law enforcement that are there today will remain in Portland until we are assured that Oregon State Police and plans that the governor has put together is successful,” he added.

Asked whether there was daylight between his comments and Brown’s, Wolf said, “The entire DHS law enforcement presence in Portland will remain in Portland.”

Acting Homeland Security Deputy Secretary Ken Cuccinelli reiterated to CNN’s Jake Tapper later Wednesday that some federal officers will remain in Portland to protect the courthouse, adding that other officers will also be in the city in case they’re needed.

“Our augmentary federal officers will still be in Portland, though not at the courthouse,” Cuccinelli said. They will be ready as a sort of standby status if they’re needed. … If peace occurs and then holds, we will draw down the officers we have moved into Portland as the need dissipates.”

CNN has reached out to the Department of Homeland Security, Customs and Border Protection, and Immigration and Customs Enforcement for an update on agency personnel in Portland. News of the agreement was received warmly by Portland Mayor Ted Wheeler, a Democrat, who said the city expects state authorities “will continue engaging only if there is violent criminal activity.

Trump has repeatedly pointed to Portland and other cities experiencing protests as evidence that Democratic officials are unable to maintain order, and has prominently featured images of clashes in his reelection campaign.

“We have the courthouse very well secure,” Trump told reporters at the White House Wednesday morning. “We’re not leaving until they secure their city.”

CNN reported Tuesday that the administration was planning to keep federal agents in Portland through at least mid-October, according to an internal email.

The email shows CBP offices being asked for teams of about 20-25 personnel. Specifically, the agency is looking for agents of a special unit that has received tactical training and can be called upon to deploy immediately when needed. The email also calls for agents from another Border Patrol unit that provides search and rescue response and intelligence personnel.

This story has been updated with comments from acting Homeland Security Deputy Secretary Ken Cuccinelli.

CNN’s Geneva Sands and Priscilla Alvarez contributed to this report.