The US Supreme Court has refused to dismantle the agency that oversees Fannie Mae and Freddie Mac but has given President Joe Biden the authority to remove the agency’s head at will.

On Wednesday, the court took a decision in relation to the mortgage giants’ shareholders, who filed a lawsuit asking it to disassemble the Federal Housing Finance Agency, believing it to be unconstitutional, and roll back the 2012 bailout agreement under which the firms have paid the government billions. The private shareholders also urged the court to return $124 billion to Fannie and Freddie.

The court agreed that the leadership structure of the FHFA violates the Constitution but sent the complaint back to the lower courts for further review.