Arizona Gov. Doug Ducey has agreed to deconstruct the makeshift border wall his administration has been building out of shipping containers for several months.
Court records show the governor and federal officials reached an agreement to "remove all previously installed shipping containers and associated equipment, materials, vehicles, and other objects from the United States' properties in the U.S. Border Patrol Yuma Sector, including from lands over which the U.S. Bureau of Reclamation holds an easement on the Cocopah Indian Tribe's West Reservation."
Last week, the Department of Justice filed a lawsuit against Ducey, accusing him of illegally placing the containers on federal land.
"Not only has Arizona refused to halt its trespasses and remove the shipping containers from federal lands, but it has indicated that it will continue to trespass on federal lands and install additional shipping containers," the DOJ said in a filing.
Since August, Ducey has spent $82 million in his efforts to fill gaps in the border barrier with containers. To date, he has covered approximately 1,800 feet -- or 182 containers -- in the Yuma, Arizona, region and about 3.5 miles in Cochise County with 982 containers, a spokesperson for the governor said.
Ducey, a Republican, agreed to remove the containers by Jan. 4, the court records show. Incoming Arizona Gov. Katie Hobbs, a Democrat, will be sworn in on Jan. 5.
In an October letter obtained by ABC News, Coronado National Forest Supervisor Kerwin Dewberry had warned Ducey that he was placing containers on National Forest System (NFS) lands.
"The Forest Service did not authorize this occupancy and use," Dewberry wrote then, urging Ducey to obtain a permit before continuing the work.
Court records show Arizona officials will now be having a discussion with the U.S. Forest Service "within one week" about safely removing containers and equipment from NFS land to "avoid and minimize damage to United States' lands, properties, and natural resources or disruption to federal actions or activities within the Coronado National Forest."
In a statement, Ducey spokesperson C.J. Karamargin said he reached an agreement because the federal government was taking steps to fill those gaps, though not with shipping containers.
"For more than a year, the federal government has been touting their effort to resume construction of a permanent border barrier. Finally, after the situation on our border has turned into a full blown crisis, they've decided to act. Better late than never. We're working with the federal government to ensure they can begin construction of this barrier with the urgency this problem demands," Karamargin said. (The DOJ has not responded to ABC News' request for comment.)
Before the lawsuit was filed, the Bureau of Reclamation had warned Ducey that he was building his wall in areas where the Department of Homeland Security was already intending to erect a border barrier.
Ducey launched his own lawsuit against the federal government in October, seeking to affirm his right to build the wall.
"Our border communities are overwhelmed by illegal activity as a result of the Biden administration's failure to secure the southern border," he said in a statement announcing his suit.
Officials with the Cocopah Indian Tribe told ABC News in October that they welcomed any challenge to the governor's efforts to place containers along the border in tribal lands, noting that a crucial emergency access road was being partially blocked by the construction.
The tribe often collaborates with U.S. Customs and Border Protection agents to help mitigate the flow of unauthorized migrants through their land and help get aid to migrants in distress.
Cocopah Public Safety Director Paul De Anda previously said the containers have "compromised our mission."
"The containers have been placed on adjacent property and they've partially blocked one of the main thoroughfares that can be used as an exit and entrance," he has said. "Not only that, it makes it more difficult for ambulances and rescue equipment to get in when we find sick and injured along the border crossing."
The Center for Biological Diversity filed a notice of intent to sue over the wall, claiming Ducey was disrupting a crucial movement corridor for endangered jaguars and ocelots in the region.
"Gov. Doug Ducey's efforts over the last two months to dump shipping containers at the border are dangerous and illegal. He wasted millions of dollars of taxpayer money for this political stunt. But we are extremely happy that he has finally agreed to clean up his mess and remove his boxcar wall," Russ McSpadden, Southwest conservation advocate with Center for Biological Diversity, previously said. "The state must also restore the damage it caused to public lands, Cocopah tribal land, the watershed of the San Pedro River and this important wildlife corridor. We'll continue to monitor the situation, and we'll weigh our legal options should Gov. Ducey fail to adhere to his promises."