CNN  — 

Microsoft has won a hotly contested contract to provide cloud computing services to the Defense Department, besting Amazon in a months-long competition in which President Donald Trump threatened to intervene.

The contract for the Joint Enterprise Defense Infrastructure is said to be worth billions of dollars over the coming decade.

Amazon had long been considered the favorite to win the contract. But that changed after Trump began raising questions about whether the process had been fair. Trump has long been critical of Amazon and its founder and CEO, Jeff Bezos.

Trump’s interjection was soon followed by an examination of the contract launched by Defense Secretary Mark Esper. Esper attended numerous informational briefings about the contract, according to the Pentagon.

Earlier this week, Defense officials suddenly said Esper was recusing himself from the final decision-making process. Friday’s award to Microsoft came days later.

A Defense Department official who recently departed and is familiar with the discussions of the contract told CNN that Trump’s animosity toward Amazon and Bezos was well known among senior Pentagon officials. Trump’s opposition to awarding the coveted contract to Amazon would flare periodically with news reports focusing on the online giant, the official said.

In a statement, Amazon said it is surprised at the decision.

“(Amazon Web Services) is the clear leader in cloud computing, and a detailed assessment purely on the comparative offerings clearly lead to a different conclusion,” the statement read. “We remain deeply committed to continuing to innovate for the new digital battlefield where security, efficiency, resiliency, and scalability of resources can be the difference between success and failure.”

In a statement to CNN on Saturday, Toni Townes-Whitley, Microsoft’s president of US regulated industries, said in part, “We are proud that we are an integral partner in DoD’s overall mission cloud strategy. As was articulated throughout the JEDI procurement, the DoD has a singular objective - to deploy the most innovative and secure commercially available technology to satisfy the urgent and critical needs of today’s warfighters.”

“We are working on this right now. In the meantime for more information see the DOD’s announcement,” the statement read.

In July, Trump vowed that his administration would take a “strong look” at the Pentagon’s contract plan, saying that “some of the greatest companies in the world” had complained including IBM, Oracle and Microsoft.

Oracle had pushed hard to scuttle Amazon’s effort, going so far as to develop a document alleging that officials inside and outside the Pentagon had conspired to help Amazon win. CNN reported in July that the document had made its way to Trump’s desk.

Multiple independent reviews of the process found little evidence of wrongdoing, however.

In a statement, the Defense Department’s Office of the Inspector General said investigators are close to completing their work reviewing the awarding of the contract.

“To date, we have not found evidence that we believe would prevent the DoD from making a decision about the award of the contract,” said Dwrena Allen, spokesperson for the inspector general’s office. “We hope to have a completed report of our findings by the end of November, which we intend to release publicly, to the maximum extent possible.”

This story has been updated.

CNN’s Barbara Starr and Jason Seher contributed to this report.