Lawmakers have urged Alphabet's Google to reconsider its ties with Chinese technology giant Huawei because it "could pose a serious risk to U.S. national security" and American consumers.

In a letter to the search giant's CEO Sundar Pichai on Wednesday, both Republican and Democrat lawmakers said they were concerned about Google's "strategic partnership" with Huawei. The two have a long-standing relationship. Huawei, which is now the third-largest smartphone maker in the world by market share, runs a version of Google's Android mobile operating system on its devices. And in January, they formed a partnership to work on a new standard of mobile phone messaging.

What appeared to annoy lawmakers was the fact that Google continued to work with Huawei when earlier this month it had stopped working with the U.S. government on a scheme called Project Maven. The project used Google's artificial intelligence (AI) technology to analyze drone footage and images to improve the targeting of drone strikes. Many employees were angry at the fact Google was working with the military.

"We urge you to reconsider Google's partnership with Huawei, particularly since your company recently refused to renew a key research partnership, Project Maven, with the Department of Defense. This project uses artificial intelligence to improve the accuracy of U.S. military targeting, not least to reduce civilian casualties," the letter said.

"While we regret that Google did not want to continue a long and fruitful tradition of collaboration between the military and technology companies, we are even more disappointed that Google apparently is more willing to support the Chinese Communist Party than the U.S. military."

Google was not immediately available for comment when contacted by CNBC.

The U.S. government has continuously accused Huawei of working on behalf of the Chinese government. In February, intelligence officials warned Americans not to buy Huawei devices because they could be used to spy on users. The Chinese electronics maker was supposed to enter the U.S. via mobile network AT&T, but the deal fell through.

Earlier this year, lawmakers introduced a new bill known as the Defending U.S. Government Communications Act, which would ban government agencies from using equipment from Chinese firms such as ZTE and Huawei.

"Over the coming months, the federal government will likely take further measures to defend U.S. telecommunications networks from Huawei and companies like it," the lawmakers' letter said.

Huawei was not immediately available for comment when contacted by CNBC.

Executives at Huawei have expressed frustrations about the accusations from the U.S. government in recent months. The head of the company's consumer business Richard Yu, claimed earlier this year that its rivals were using politics to kick it out of the U.S. market.

Tension between China and the U.S. has heightened in recent weeks amid rising trade tensions between the two nations. Other technology firms have also been dragged into it, including telecommunications firm ZTE.