Donald Trump’s government scored a win on Tuesday when a court ruled in favor of it in a challenge brought by a group of states against the authority of Elon Musk, the Republican president’s top government cost-cutter.

The Washington-based U.S. district judge Tanya Chutkan ruled in the lawsuit filed by Democratic Attorneys General from 14 states, who claimed that Musk, Tesla’s billionaire CEO, lacked the legal authority to fire federal employees in mass or gain access to sensitive government computer systems.

Attorneys general claimed they were in danger of losing the ability to implement educational programs and other initiatives. Musk’s team was accused of illegally accessing federal data and of directing a purge of the 2.3 million federal employees. More than a dozen state attorneys general announced the lawsuit. They included New Mexico, Michigan, and Arizona.

Musk is the head of an organization called the Department of Government Efficiency (DOGE). Since Trump’s return to office, the DOGE has been sweeping through federal agencies and dismantling programs. Musk was put in charge of eradicating wasteful spending and slashing thousands upon thousands of federal jobs.

According to the state attorneys general, Musk has the type of power that is only available to an officer of the government who was nominated by the president and confirmed by a U.S. Senate based on the Appointments clause in the U.S. Constitution. States have also said that DOGE has not been approved by Congress.

The lawsuit aims to prevent DOGE from gaining access to information systems in the Departments of Labor, Education, Health and Human Services, Energy, Transportation, and Commerce, as well as the Office of Personnel Management.

Chutkan was also asked by the group to stop Musk and his DOGE Team members from firing or putting federal employees on leave.

On February 14, an attorney for the administration informed Chutkan that he was unable to confirm that mass layoffs had taken place.

Musk has been sued in federal court by around 20 people, with mixed results.

U.S. District Judge Jeannette Vargas, in New York, extended a temporary ban on DOGE Friday. This prevented Musk’s Team from accessing Treasury Systems responsible for trillions of dollars of payments.

Also on Friday, U.S. district judge John Bates, in Washington, declined to grant a request from unions and nonprofits that temporarily blocked Musk’s team access to records at the Departments of Labor, Health and Human Services, and the Consumer Financial Protection Bureau.

The majority of judges who are handling DOGE cases have not yet made a ruling.