The Department of Defense announced Wednesday that Cerner had been awarded a coveted $4.3 billion, 10-year contract to overhaul the Pentagon’s electronic health records for millions of active military members and retirees.

The award to the Leidos Partnership for Defense Health — which includes Cerner, an electronic-health-records manager; Accenture Federal; and Leidos, a government contractor based in Reston, Va. — was considered an upset among industry experts. Many had predicted that the bid anchored by Epic Systems, considered a titan in the medical-records field, would land the contract.

Over its potential 18-year life, the contract could be worth just less than $9 billion, officials estimate.

The partnership will be responsible for upgrading and managing the Pentagon’s health records for 9.5 million beneficiaries at about 1,000 sites including U.S. clinics and hospitals, and some of the most challenging and remote health-care sites in the world, including in Iraq and Afghanistan.

“The Leidos Partnership for Defense Health is honored to have partnered with the Military Health System for nearly three decades, and we are committed to continuing our work in support of its mission to improve the health and medical readiness of our military,” a spokesman for the partnership said in a statement. “Our team stands ready to lean forward with the DoD to implement a world class electronic health records system.”

The announcement caps an acquisition process that spanned two years and challenged Pentagon officials to consider a wide array of factors in their vision for a new system: heightened cybersecurity; ease of use for physicians; and the concerns of outside critics about entering into a long-term contract at a time when the electronic-health-records industry is changing rapidly.

“We have taken the time to do this job right,” said Frank Kendall, the undersecretary of defense for acquisition, technology and logistics. “If you don’t get the contract right, you’re going to set yourself up for problems later on.”

In remarks made earlier Wednesday, Defense Department officials said the announcement, while significant, is one step in a process that will take as much as eight years to reach all patients.

Officials hope the software will be fully deployed by the beginning of 2023.

“We recognize that today is just the beginning,” said Christopher Miller, who has directed the department’s acquisition process. “We understand that the hard part is just about to start.”

Earlier this year, the department announced that a field of applicants had been narrowed to three finalists: Epic, Cerner and Allscripts, each of which had teamed with other partners. Epic joined with IBM and Impact Advisors, while Allscripts teamed with Hewlett-Packard and Computer Sciences.

The Epic and IBM partnership had been considered by most experts to be the favorite, largely because Epic holds some of the most desirable health-records contracts in medicine, including deals with the Mayo Clinic and Kaiser Permanente. In a statement, IBM expressed disappointment at the outcome, saying it had the most innovative technology platform to serve the Defense Department.

But Cerner’s bid through the Leidos Partnership for Defense Health promoted a vision of providing health-care “wherever and whenever care is required” — an apparent nod to the unique challenges the Defense Department faces in providing medical services in a variety of environments.

The next step will involve extensive testing of the software’s security and usability. Department officials say they hope by 2016 to begin operational testing, which involves a limited deployment at several facilities in the Pacific Northwest.

“It will make or break the success of the program,” Miller said in an interview.

For the Defense Department, the announcement culminates a tumultuous period trying to decide what to do about AHLTA, a long-troubled software that is aging and is increasingly costly to maintain. Doctors and nurses have criticized AHLTA as slow, clunky and difficult to use and plagued by frequent crashes.

Some were so unhappy with the program, officials have said, that they left the military health-care system altogether, while others threatened to do so if the department did not fix it or change course. There was even a congressional hearing in 2009 to address the issues — with the Army surgeon general warning that there was “a near mutiny” from health-care providers who were dissatisfied with the software.

At the same time, there was a separate but related issue: how to make records seamlessly accessible between the Defense Department and the Department of Veterans Affairs.

Years ago, there were plans for the two departments to jointly develop an electronic-health-records system, but that effort was abandoned in 2013 because of rapidly rising costs.

Critics have continued to cast doubts on the Defense Department’s forging ahead with its plan for a commercial system, dubbed an “off-the-shelf” product. Those critics have claimed that the closed-off nature of such products could possibly jeopardize the department’s ongoing efforts to share more records with Veterans Affairs.

Pentagon officials have sharply disputed those assertions. They said they look forward to updating Congress soon about their ongoing interoperability with VA, including details about millions of records that are already jointly accessible by the two departments.

“Those things bother me. People make these assertions that we’re going to break our data sharing or somehow fall behind,” Miller said. “I don’t think people have spent enough time looking at how we’re trying to attack the problem.”

Miller said there are other misconceptions, including that the Defense Department is entering into a lengthy contract with no way out. He said the contract has been meticulously scrutinized and includes clauses that would give the department a way out, if needed, should problems emerge.