A judge has turned aside a request to temporarily lift a long-standing ban on contributions by federal contractors to political campaigns.

Federal contractors have been prohibited for more than 70 years from donating to candidates, political committees and parties in federal elections.

In a lawsuit, three federal contractors allege that the ban violates freedom of speech.

U.S. District Judge James Boasberg rejected the contractors' request that the Federal Election Commission be barred from enforcing the ban until the judge issues a final ruling in the case.

In rejecting the request for a preliminary injunction, Boasberg said it is well established that preventing even the appearance of corruption is an important government interest justifying restrictions on political giving.

The ruling by Boasberg, an appointee of President Barack Obama, comes at a time when campaign finance restrictions are increasingly the focus of challenges. In one high-profile case, Citizens United, the Supreme Court gave a green light for corporations and labor unions to spend unlimited sums of their cash on campaign ads. That effectively led to the expansion of "super" political action committees, which have spent more than $50 million on the Republican primary elections and are largely funded by wealthy donors.

The law banning contractor donations is designed to guard against pay-to-play arrangements: People seeking contracts providing money to political candidates in exchange for help getting government business. The law also is intended to protect contractors from pressure to contribute or risk losing government business. Violating the law can result in a five-year prison term.

Congress passed the ban in the aftermath of scandals involving federal contractors.

Two of the contractors in the current case work for the U.S. Agency for International Development. The third works for the Administrative Conference of the United States, an independent federal agency dedicated to improving the administrative process in government.

Boasberg issued his ruling Monday.