A divided U.S. Supreme Court said the president must have broad power to fire the director of the Consumer Financial Protection Bureau, ruling that Congress went too far in trying to insulate the agency from political pressure.

The justices on Monday largely backed the Trump administration in the separation-of-powers clash, striking down a provision that protected the director from being fired and putting the CFPB and potentially other federal agencies more firmly under presidential control. The court stopped short of abolishing the agency altogether.

The ruling marks a major change for the CFPB, the brainchild of now-Senator Elizabeth Warren created after the 2008 financial crisis to regulate credit cards, auto loans and other consumer finance products.

Congress gave the director a five-year term, plus a shield from dismissal except in cases of “inefficiency, neglect of duty, or malfeasance in office.” But the court said the Constitution doesn’t let Congress give an agency director so much freedom from elected officials.