The lawsuit’s claims were inflammatory: that Apple “schemed” and “conspired” with controversial Indian outsourcing firm Infosys to bring trainers into the U.S. in an illegal and fraudulent maneuver to get around the expense and difficulty of obtaining H-1B visas.

On Tuesday, Apple and Infosys scored a victory. Judge Lucy Koh of the U.S. District Court in San Jose dismissed the lawsuit, filed in 2016 by Carl Krawitt, a former Apple contractor employed by Infosys. But Koh left open the opportunity for Krawitt to keep the suit alive, granting him leave to amend his complaint with additional facts.

At the heart of the whistle-blower lawsuit’s claims were visas obtained by Apple and Infosys for two Indian citizens who were brought to the U.S. to provide training at the Cupertino iPhone giant, for the engineering team behind online sales. Krawitt claimed the two companies “systematically” created fraudulent documents and misrepresented the type of work the trainers would do, in order to bring them in under B-1 visas — intended for temporary business visitors — instead of the more expensive, harder-to-get H-1B visa, which is intended for jobs requiring specialized knowledge and a bachelor’s degree or higher.

Krawitt, who said in the lawsuit that he started working for Infosys at Apple in 2014, further claimed that the work of the two trainers could have been performed by American citizens. He alleged that when he told a senior Infosys manager that Infosys and Apple were acting illegally in seeking the B-1 visas, he was threatened with firing unless he kept quiet.

Apple and Infosys did not immediately respond to requests for comment on the claims in the lawsuit, or Koh’s dismissal.

Apple in June asked Koh to toss out the case, arguing in a court filing that Krawitt’s claims were premised on a misunderstanding of U.S. immigration laws, “which permit non-immigrants to enter the United States on B-1 visas for ‘business’ that is incidental to international commerce.”

Apple noted that it had contracted with Infosys for more than $100 million in services in 2014 alone.

The H-1B visa has become a flashpoint in the U.S. immigration debate, with tech companies lobbying heavily for an expansion of the annual 85,000 cap on new visas, and critics pointing to reported abuses and claiming companies, including outsourcers such as Infosys, use it to replace American workers with cheaper, foreign labor.

Krawitt, in his suit, pointed to a $34 million fine Infosys paid in a 2013 settlement with U.S. authorities, after the federal government accused the company of using B-1 visa holders for jobs in the U.S. that would otherwise have gone to U.S. citizens or H-1B visa holders.

But Koh didn’t buy Krawitt’s central claims. “The two trainers acted within the scope of their B-1 visas in providing training sessions to Apple,” Koh said in her decision. “The training provided meets the standard of being incident to international trade or commerce.”

The trainers were brought in temporarily, Koh added, noting that federal regulators have deemed the B-1 visa appropriate for foreign citizens coming to the U.S. “solely for the purpose of supervising and training others.”

Koh also addressed Krawitt’s claim that the trainers’ work could have been done by Americans. “If Congress intended to shield all industries from foreign competition, then the B-1 visa likely would not exist,” Koh said in her ruling.

Law firm Pierce Bainbridge, representing Krawitt, said in a statement Wednesday that it was evaluating Koh’s decision closely and would include “additional factual allegations” in an amended complaint “to address the judge’s concerns and press forward to hold Apple and Infosys accountable to the United States and its taxpayers.”