Huawei is suing the U.S. over a law that bans government agencies from buying the Chinese technology giant's equipment, claiming the legislation is unconstitutional, as the company goes on the front foot following months of political pressure.

The lawsuit, which was filed on Thursday local time, focuses on a provision in a law known as the National Defense Authorization Act. Section 889 of that legislation prohibits executive government agencies from procuring telecommunications hardware made by Huawei and another Chinese firm, ZTE. Both companies are explicitly named in the act.

But lawyers for the world's largest network equipment maker by revenue, argued that the provision in the NDAA is against the U.S. Constitution.

Huawei has faced intense pressure from President Donald Trump's administration, which claims the company's equipment could be used for espionage by the Chinese government. The tech giant is also facing criminal charges from the Justice Department, which has accused it of stealing trade secrets and skirting U.S. sanctions on Iran. The U.S. government has also tried to persuade allies against using Huawei gear.

Top executives, including the company's founder, have repeatedly denied the allegations that Huawei is a security risk, while the company has also been carrying out a major public relations push to change its image. The Chinese firm is now going on the legal offensive.

Byers Market Newsletter Get breaking news and insider analysis on the rapidly changing world of media and technology right to your inbox. This site is protected by recaptcha

Huawei argues that the provision in the NDAA in which it is explicitly named is really a "bill of attainder" — wherein a legislative act pronounces a specific individual or group guilty of some offense and punishes them without due process. That's forbidden by the U.S. Constitution. The company's lawyers also argued that Section 889 is unlawful because it violates Huawei's right to due process, meaning the firm cannot hear the evidence against it and fight that in court.

Huawei's legal team is essentially arguing that, by including the provision in the legislation and banning the company's sales to federal agencies in law, Congress is unconstitutionally acting as a judiciary.

The federal district court where the lawsuit is filed will make a decision on whether Huawei's lawsuit will hold. Either side — Huawei or the U.S. government — can appeal that decision. A court has the power to invalidate a part of legislation without ripping apart the entire law. So, in theory, Huawei could get Section 889 thrown out.

Huawei will be hoping that by getting Section 889 of the NDAA scrapped, it could open the door for conversations with the U.S. government.

Glen Nager, lead counsel for Huawei and partner at Jones Day, claimed Thursday to CNBC that the American law is "hurting Huawei's customers in the United States."

"It's damaging Huawei's reputation and it's limiting the ability of Huawei to provide its innovative products, including 5G, to consumers in the United States," he added. "Huawei hopes that it can engage in a constructive conversation with the president and his administration over how to bring these innovative technologies and Huawei competition to the United States while providing full assurance of security for the United States of America."

Huawei has long argued that its absence from the U.S. market will hamper competition in the next generation of mobile networking technology — a claim that experts have contested.

The technology firm is also fighting fires on other fronts. Huawei Chief Financial Officer Meng Wanzhou, the daughter of founder Ren Zhengfei, was arrested in Canada in December and was accused of breaking U.S. sanctions against Iran. She faces extradition to the U.S. But the CFO's lawyers are now suing Canadian authorities, alleging they arrested, detained and searched her in violation of her constitutional rights.

Huawei's lawsuit against the U.S. bears some similarities to a case in 2018 involving Russian cybersecurity firm Kaspersky Lab. In September 2017, the U.S. Department of Homeland Security ordered government agencies to stop using Kaspersky software, alleging it could be used for espionage by Russia. The ban was later ratified in law.

Kaspersky filed two lawsuits against the government with one claiming the move amounted to a bill of attainder. The two lawsuits were thrown out by a judge in May and Kaspersky also lost an appeal later in the year.