WASHINGTON — On Friday the Saudi government finally admitted that writer Jamal Khashoggi had died inside its Istanbul consulate, saying he had been killed in a fight.

Asked to respond to the Saudi statement, President Donald Trump called it an “important first step,” then began talking about the size of planned U.S. arms deals with the kingdom, cautioned against retribution against Riyadh and said, “I’m going to speak to the crown prince.”

From the outset of his presidency, Trump has offered a warm embrace to Saudi Arabia and its ambitious royal heir, Mohammed bin Salman, believing he could help the U.S. confront Iran in the Middle East.

But the gamble appears to have backfired badly, say experts and former officials, with the young prince now implicated in the killing of Khashoggi, who dared to criticize the regime.

The United States has long turned a blind eye to Saudi Arabia’s repression at home and its intolerance of dissent to maintain a strategic alliance with the oil-rich kingdom. Trump, however, has cultivated Saudi Arabia to an unprecedented degree, blessing the 33-year-old crown prince’s ascent in the royal family and his crackdown on opponents and rivals, former U.S. officials and Western diplomats said.

“Every American president since FDR has courted the Saudis, but none of them have done it as avidly and crudely as Donald Trump,” said Bruce Riedel, a former CIA officer who served in the spy agency for 30 years.

In his first trip abroad as president last year, Trump made the unusual choice to travel to Riyadh, where he took part in a traditional all-male dance with the Saudi royals, swaying back and forth with a ceremonial sword in hand.

"That was a tremendous day. Tremendous investments into the United States, and our military community is very happy," Trump tweeted after his first day of meetings. The Saudis projected his words on large digital displays. Trump referred to the trip again on Friday in his reaction to the Saudi admission of involvement in Khashoggi’s death.

White House senior adviser Jared Kushner at the Royal Court in Riyadh, Saudi Arabia, on May 20, 2017. Jonathan Ernst / Reuters file

But the vast arms sales and investments promised haven't yet materialized. The Saudis are still haggling with the U.S. about the cost of buying the THAAD ballistic missile defense system. Instead of the $110 billion in arms sales initially touted by Trump, now the administration says only about $14 billion worth of weapons have been implemented with signed letters — and many of those originated under the previous administration.

The State Department was largely shut out of the planning for the president’s trip to Riyadh, and instead the task was entrusted to Trump’s son-in-law, Jared Kushner, a senior adviser to the president. The young real estate businessman with no diplomatic experience reportedly came away impressed by the crown prince, as they were two thirty-somethings anointed by powerful families with shared agendas

Inside Saudi Arabia, the crown prince is sometimes derisively referred to as “Mohammed bin Kushner,” said Riedel, who wrote a book on the U.S.-Saudi relationship.

Driving the courtship was the crown prince’s fixation on combating Iran.

Mohammed bin Salman, or MBS, “is viscerally anti-Iran,” said former CIA director John Brennan, now an NBC News analyst. “He strongly opposed the Iranian nuclear agreement, and he found partners in the Trump White House with little understanding of the complexities of the Middle East eager to scuttle it.”

Weeks after the president’s visit to Riyadh, Saudi Arabia and other Gulf allies imposed a blockade on Qatar, accusing it of funding Muslim Brotherhood militants and backing Shiite-ruled Iran. It was another bold and controversial move by the Crown Prince that alarmed Western governments, but Trump gave it his endorsement.

“During my recent trip to the Middle East I stated that there can no longer be funding of Radical Ideology. Leaders pointed to Qatar — look!” the president tweeted on June 6, a day after the blockade was announced.

During my recent trip to the Middle East I stated that there can no longer be funding of Radical Ideology. Leaders pointed to Qatar - look! — Donald J. Trump (@realDonaldTrump) June 6, 2017

The same month, the Trump administration reversed a suspension by President Barack Obama of the sale of precision-guided bombs to the Saudi-led coalition waging war in Yemen. Obama had objected to civilian casualties. Congress narrowly approved, along partisan lines, a resumption of the weapons deliveries, despite repeated reports from human rights groups that the Saudis were using the bombs to hit civilian targets.

“The decision to end the prohibition on the sale of precision weapons to Saudi was a big early signal that he was going to be in MBS’ corner … and dismiss all that nitpicking about human rights issues,” said William Hartung, the director of the Arms and Security Project at the Center for International Policy, a left-of-center think tank.

The crown prince had impressed Trump administration officials as well as other Westerners with talk of opening up the Saudi economy, undercutting hardline Islamist ideologues and cracking down on corruption. But his iron-fisted methods raised concerns in and outside the country. A pivotal moment came in November 2017, when he rounded up and temporarily detained hundreds of the country’s most powerful figures, including members of the royal family. Some were confined at the Ritz-Carlton Hotel in Riyadh, and some were tortured.

The round-up stunned and infuriated many inside the House of Saud, but Trump gave MBS a big thumbs up.

“I have great confidence in King Salman and the Crown Prince of Saudi Arabia, they know exactly what they are doing...” he tweeted. “....Some of those they are harshly treating have been “milking” their country for years!”

I have great confidence in King Salman and the Crown Prince of Saudi Arabia, they know exactly what they are doing.... — Donald J. Trump (@realDonaldTrump) November 6, 2017

....Some of those they are harshly treating have been “milking” their country for years! — Donald J. Trump (@realDonaldTrump) November 6, 2017

Prior to the crown prince’s rise, successive administrations had forged close ties to Mohammed bin Nayef, a nephew of the king who won the trust of U.S. intelligence agencies for his cooperation on counterterrorism efforts during his time as minister of interior. He had been seen as the heir to the throne, until Mohammed bin Salman won favor with the king, his father, and pushed Mohammed bin Nayef aside last year.

"MBN did not go willingly. MBS reportedly cleared his removal with Washington, whether that was the White House or CIA. He wanted to make sure there were no repercussions for the relationship," Brennan told NBC News.

Asked if the administration weighed in on the rivalry, a State Department official, who asked not to be identified because was not authorized to speak on the record, told NBC News, “Succession is an internal matter for the Kingdom of Saudi Arabia.”

Other former officials said the demotion of Mohammed bin Nayef was an ominous sign. “Letting Mohammed bin Salman push out Mohammed bin Nayef is the original sin of this relationship,” said Ali Soufan, a former FBI official who has written extensively about counterterrorism in the Middle East. “Mohammed bin Nayef was the most important counterterrorism official in the Middle East [and] had worked with the U.S. for decades.”

The president and his aides believed President Obama had abandoned Arab allies and that the crown prince would be a crucial partner in rolling back Iran’s influence in the region. They were willing to suspend judgment when it came to MBS’s excesses, officials said, even as criticism mounted around the globe.

But the death of Washington Post columnist Jamal Khashoggi, a critic of the crown prince who had longstanding ties to the Saudi royal family, has placed Trump’s relations with the crown prince under unprecedented scrutiny.

Turkish officials have alleged Khashoggi was murdered and dismembered inside the Saudi consulate in Istanbul by a Saudi hit team, reportedly with links to the crown prince. On Friday, Saudi Arabia put out a statement claiming its agents choked Khashoggi to death after a fistfight. Riyadh said 18 officials had been arrested but the crown prince was not one of them. Instead, Mohammed bin Salman was empowered to reorganize the intelligence service in yet another promotion.

Despite international outrage, Trump remains reluctant to break with the crown prince who he has worked so hard to cultivate, even as lawmakers from both parties dismissed Saudi Arabia’s account as a whitewash.

“The brutality of it, the sheer nastiness grabbed people. People knew Jamal. It’s personal,” said Gerald Feierstein, a former senior U.S. diplomat who served as ambassador to Yemen and other posts. The crown prince’s abuses now were “no longer abstract.”

Trump and his team pinned their hopes on an impetuous and reckless crown prince, he said, partly out of a yearning to make a break with the previous president’s policies.

“So why did the administration fall for it? Ignorance, naïveté by Trump and Kushner, lack of experience and being taken in by Saudi promises,” Feierstein said. “Also, there was the desire to reverse Obama’s policies. They believed Obama sucked up to Iran, so they would suck up to Saudis.”

The White House did not immediately respond to a request for comment.