WASHINGTON—A U.S. judge dismissed a pair of lawsuits filed by Russian cybersecurity firm Kaspersky Lab demanding the U.S. government rescind a ban on the use of its software in U.S. government computers, saying the action was justified to reduce cybersecurity risk.

“These defensive actions may very well have adverse consequences for some third-parties,” U.S. District Judge Colleen Kollar-Kotelly wrote in her Wednesday ruling. “But that does not make them unconstitutional.”

Kaspersky Lab, a privately held company, had filed a lawsuit in the U.S. District Court for the District of Columbia challenging a directive imposed last year by the Department of Homeland Security ordering federal agencies to purge the antivirus company’s software from federal networks due to American concerns the Moscow-based firm may have ties to Russian intelligence. The company also had challenged a law passed by Congress that codified the ban.

In a statement, Kaspersky Lab, a global cybersecurity firm founded by Russian businessman and computer expert Eugene Kaspersky, said it was disappointed in the ruling and would “vigorously pursue our appeal rights.”

“Kaspersky Lab maintains that these actions were the product of unconstitutional agency and legislative processes and unfairly targeted the company without any meaningful fact finding,” the company said. The company has repeatedly denied accusations it uses its software to conduct espionage for Russia.