A federal district judge in Washington struck down most of the key provisions of three executive orders that President Trump signed in late May that would have made it easier to fire federal employees.

The ruling, issued early Saturday, is a blow to Republican efforts to rein in public-sector labor unions, which states like Wisconsin have aggressively curtailed in recent years. In June, the Supreme Court dealt public-sector unions a major blow by ending mandatory union fees for government workers nationwide. (Federal workers were already exempt from paying such fees.)

The ruling is the latest in a series of legal setbacks for the administration, which has suffered losses in court in its efforts to wield executive authority to press its agenda on immigration, voting and the environment.

The executive orders, which also rolled back the power of the unions that represent federal workers, had instructed agencies to seek to reduce the amount of time in which underperforming employees are allowed to demonstrate improvement before facing termination, from a maximum of up to 120 days to a maximum of 30 days, and to seek to limit workers’ avenues for appealing performance evaluations. The orders also sought to significantly reduce the amount of so-called official time that federal employees in union positions can spend on union business during work hours.