They were dismissed as part of President Donald Trump's ambition to reduce the size and scope of the state.
Judge William Alsup at the court in San Francisco says that the motivation "poor performance" for the mass layoffs was "a bluff to try to avoid statutory requirements", reports New York Times.
The affected authorities are the departments of war veterans, finance, interior, agriculture, defense, and energy.
Thursday's decision is one in a series of legal setbacks for the Trump administration and was immediately condemned by the White House. Press Secretary Karoline Leavitt promised that they would "fight back against this absurd and unconstitutional order".