The last National Guardsmen are leaving Washington, D.C., after a mission that involved about 26,000 troops at its highpoint and a total cost of $521 million over more than five months finally comes to an end, defense officials said.

About 1,600 National Guardsmen are still in the nation’s capital as they complete out-processing, said Pentagon spokesman Army Lt. Col. Christian Mitchell. All of the troops taking part in the mission are expected to be heading home by Wednesday.

“As these troops depart for home and a much-deserved reunion with loved ones, I hope they do so knowing how much the nation appreciates their service and sacrifice – and that of their families and employers,” Defense Secretary Lloyd Austin said on Monday. “I hope they know how very proud we are of them.”

This significant allocation of troops and money was a result of the Jan. 6 Capitol riots, when people taking part in a rally to support then-President Donald Trump stormed Congress to prevent lawmakers from certifying President Joe Biden’s victory in the Electoral College.

An active-duty Marine major has been charged with assault for allegedly taking part in the riot. Four other service members from the reserve component and 41 veterans also face charges in connection with the insurrection.

Prior to the rally, only 340 unarmed National Guardsmen had been deployed to Washington, D.C., to help local police with crowd and traffic control. It wasn’t until roughly three hours after a mob of Trump supporters forced their way inside the Capitol building that the first troops arrived at the scene of the riot.

Christopher Miller, who was serving as acting defense secretary at the time, approved mobilizing all 1,100 members of the Washington, D.C., National Guard as the riot was taking place. That evening, he had authorized mobilizing 6,200 National Guardsmen to protect the presidential inauguration, and that number grew to more than 26,000 by Jan. 20.

Initially, the National Guardsmen were supposed to leave the nation’s capital in March, but Austin extended their mission for another two months at the request of U.S. Capitol Police.

That extension added roughly $111 million to the cost of the mission for a total of $521 million, according to the National Guard Bureau.

Overall, the National Guard’s mission to Washington, D.C., was a success, said retired Army Lt. Gen. Russel Honoré, who led a security review following the Capitol riots.

While one U.S. Capitol Police officer was killed in April when a man allegedly rammed a barricade, the National Guard’s presence stabilized the situation in Washington, D.C., and prevented another riot from happening, Honoré said.

At the same time, Honoré said he believes the National Guard’s mission to the nation’s capital could have ended sooner.

“I think we kept too many of them there too long,” Honoré said. “Everybody was concerned between 1/6 and the inauguration that some s**t was going to go down, ok. They successfully secured the inauguration. That was what they were there for: to lock that place down working with all federal agencies in the district to ensure that we didn’t have a repeat of 1/6, and they did that magnificently.”

“I think if they do an after-action report that many will agree that they could have demobilized quicker,” he continued. “The more you use them, the less you got in the tank, and they were used a lot, and it was cold as hell.”