Even without the ban, the Trump administration has taken a hard line with allies, telling them that allowing Huawei to build and maintain 5G systems, even if they are operated by Western companies, could give Beijing an undetectable backdoor into wireless networks.

The fear is that the Chinese government will be able to suck up and copy data flowing over wireless networks, potentially compromising that information and, theoretically, putting trade secrets and military intelligence at risk. While much of that data is encrypted, giving Chinese firms control over the flow of data is considered a major risk by the Pentagon and intelligence agencies.

But to Mr. Trump, 5G is an election issue as much as a security issue. Speaking at the White House, surrounded by wireless company workers wearing cowboy hats and hard hats, Mr. Trump said the United States could not allow itself to be “outcompeted” in 5G networks.

“The race to 5G is a race America must win,” Mr. Trump said. “And it is a race frankly that our great companies are now involved in. We have given them the incentive they need. It is a race we will win.”

The Trump administration had considered a plan that would have created national 5G networks using federal money. Mr. Trump said on Friday that that approach had been rejected and that private industry would build out the American 5G networks.

Mr. Trump made no mention of China or any Chinese companies like Huawei, though he did say 5G networks must be “guarded from the enemy — and we do have enemies out there.”

Mr. Trump also repeatedly said he would extend broadband access to rural America. “No matter where you are you will have access very quickly to 5G, and it will be a different life,” Mr. Trump said.