A judge has temporarily blocked the Trump administration from laying off thousands of federal workers during the government shutdown.

It comes less than a week after the administration confirmed several agencies had begun laying off about 4,000 workers.

US District Judge Susan Illston granted a request by two unions to block layoffs at more than 30 agencies.

During the hearing, Illston said she agreed with the unions that the administration was unlawfully using the lapse in funding, which began on 1 October, to carry out its plans to downsize the federal government.

She also cited a series of public statements by President Donald Trump and the White House's budget chief, Russell Vought, that she said showed explicit political motivations for the layoffs, such as Trump saying that cuts would target "Democrat agencies."