The federal government has tapped the nation's second-largest cellphone carrier to build a first-of-its-kind wireless network — one that promises to help firefighters, police and medical workers more easily communicate during a major emergency.

The 25-year contract announced Thursday directs AT&T to build and maintain the network, which is known as FirstNet and is unprecedented in its level of sophistication and scale.

When federal, state or local authorities arrive at the scene of an emergency today, their communications devices must compete with those of consumers who are also trying to access the cellular network, FirstNet executives said. That can lead to congestion and delays that endanger lives.

But the FirstNet network will be designed to give priority to first responders, said FirstNet President T.J. Kennedy. Through special SIM cards inserted in their phones, police, fire and medical officers will be better able to communicate with one another. Much like current technology, the new network will allow them to send and receive video, data and voice calls before they reach a crisis area. But that information will arrive uninterrupted and in real time.

“They will always be prioritized. They're always at the front of the line,” Kennedy said. "This happens inside the network at the millisecond level."

FirstNet is administered by the Commerce Department and was proposed in the years after Sept. 11, 2001, when emergency workers responding to the day's terrorist attacks struggled to communicate across clogged channels and incompatible technologies.

Under the contract, AT&T will spend $40 billion of its own money deploying FirstNet. It will also receive $6.5 billion from the government at the end of five years if it successfully meets a number of milestones designed to fast-track the project. And the government is awarding the company with as much as 20 megahertz of new wireless airwaves that AT&T intends to integrate into the service. That “spectrum,” as it's known, will expand the network's capacity and help ensure that communications do not fail.

“First responders use more than 10,000 networks for voice communications,” AT&T said in a release. “These networks often do not interoperate, which severely limits their ability to communicate with each other when responding to a situation. FirstNet’s mission is to fix this.”

AT&T's extensive existing infrastructure means that the company may move more quickly to set up FirstNet, which will be available in all 50 states.

“It's not going to be a build-from-scratch type of thing,” said FirstNet chief executive Mike Poth. “So it's a win for us and public safety because it's going to accelerate the time to market.”

To take advantage of the network's capabilities, public safety departments will need to buy a subscription to FirstNet. Automatically included is the preemption feature, which is among the most-requested by first responders, said Chris Sambar, AT&T's senior vice president for FirstNet.

Sambar declined to say how expensive the rate plans will be but said that they would be priced “below market [rates]."

Designing a system such as FirstNet has taken years because of the sheer number of public safety departments in the United States who expect to use the network, according to an industry official who spoke on the condition of anonymity because details of the project remain private.

“It's been a long hard slog, because it's complicated technically to think about building a network like this,” the official said. “We'll see how it goes, but obviously AT&T's serious about it and it has the potential to be a big win for public safety.”