ISTANBUL — Friends of the missing Saudi writer Jamal Khashoggi described him as being deeply afraid of his country's rulers and of being targeted by the powerful Crown Prince Mohammed bin Salman in the months before his disappearance.

Turkish authorities say they believe Khashoggi, a journalist and critic of Saudi policies, was killed at the Saudi consulate in Istanbul last week, a claim denied by the Persian Gulf kingdom's officials.

Barnett Rubin, a senior fellow at NYU's Center on International Cooperation who met Khashoggi almost 30 years ago, said his friend had believed the crown prince was a threat.

“The kid is dangerous,” Khashoggi wrote in an email in September 2017, according to Rubin, referring to the prince. “I’m under pressure from my wife and friends to be wise and stay silent. I think I should speak wisely.”

A prominent journalist once close to the inner circle of Saudi Arabia’s huge royal family, Khashoggi went into self-imposed exile in the U.S. after Salman replaced older cousin Prince Muhammad bin Nayef as crown prince in June 2017. In the U.S., Kashoggi became a contributor to The Washington Post.

Mohammed bin Salman, 33, King Salman's son, was at first hailed internationally for efforts to reform his country's oil-dependent economy and modernize the deeply traditional society. President Donald Trump's White House embraced him, and Saudi Arabia was the site of the president's first trip.

Saudi Crown Prince Mohammed bin Salman Abd Rabbo Ammar / Pool via SIPA

International attention has more recently focused on Saudi Arabia's widespread crackdown on dissent, although the prince is believed to be popular at home.

The crown prince’s clampdown has included death sentences for three prominent clerics — an unprecedented move — and the arrest of women’s rights activists. When Canada criticized the treatment of the female activists in August, Saudi Arabia retaliated by expelling Canada’s ambassador, withdrawing its own envoy from Ottawa and other punitive measures.

Randa Slim, director of conflict resolution at the Middle East Institute in Washington, recounted that when Khashoggi was still in Saudi Arabia he got a call from "somebody close to Mohammed bin Salman ... basically saying, 'You cannot tweet, you cannot appear on TV, you cannot write — period.'"

The situation changed drastically after the detention of some of the country's most powerful princes and businessmen in the Ritz-Carlton, Riyadh, in September 2017, added Slim, who first met Khashoggi in 2012 at a panel discussion on the Middle East.

"I think he felt after that there are no limits," she said. "That there were certain red lines that in the past Saudi rulers never crossed especially when it comes to how they dealt with princes and other members of the royal family, and that those red lines were being crossed."

She added, "After that he became very aware that it was going to be very hard."

Slim said that the situation had taken a huge personal toll on Kashoggi, and he was worried about his family in Saudi Arabia. The government had imposed a travel ban on his son, for example.

“He was so lonely, he missed his home so much,” Slim said. “He paid a personal price, and it weighed on his mind a lot.”

But she said his desire to write outweighed his homesickness.

“It was very hard for him to consider existing, living without the freedom to write and to publish, no matter what the consequence,” she said, adding that when she last saw Khashoggi in the spring, he had stopped going to a Washington mosque linked to the Saudi government.

Before his disappearance, Khashoggi wrote a regular opinion column for The Washington Post in which he criticized the jailing of clerics, businessmen and academics, among others.

Khashoggi criticized the Saudi-led war in Yemen, which has helped create what many aid groups call the world's worst humanitarian crisis, a dangerous rift with fellow Gulf kingdom Qatar, the spat with Canada and its arrest of women’s rights activists.

Khashoggi also wrote about the difficulties of Saudis' being granted some freedoms, while also being silenced.

"Do we only voice glowing references to our leader’s decisions, his vision of our future, in exchange for the right to live and travel freely — for ourselves and our wives, husbands and children, too?" he asked in a column in May.

He added, "I have been told that I need to accept, with gratitude, the social reforms that I have long called for while keeping silent on other matters — ranging from the Yemen quagmire, hastily executed economic reforms, the blockade of Qatar, discussions about an alliance with Israel to counter Iran, and last year’s imprisonment of dozens of Saudi intellectuals and clerics."

He was also worried about how critics' families were being targeted, said Noor Haddad, a Syrian journalist in Istanbul who interviewed Khashoggi last month.

“What he really disliked ... was the crackdown on the opposition, but not just the opposition, they extended it to their families,” she said.

Friends said Khashoggi was also fearful in his new home, Washington.

One friend said that, as a safety precaution, Khashoggi would send a text when he entered and left the Saudi embassy in Washington.

Turkish police barriers block the road leading to the Saudi consulate in Istanbul on Sunday, Oct. 7, 2018. Emrah Gurel / AP

"He was afraid going in. He was afraid even in Washington," said the friend, who spoke on the condition of anonymity because she worried that if she commented publicly Saudi Arabia would try to twist her words for propaganda purposes.

Khashoggi's disappearance after he entered the Saudi consulate in Istanbul appears to have happened as he was seeking documents related to a divorce that he needed for his upcoming marriage to a Turkish woman, four individuals with knowledge of his situation told NBC News.

Khashoggi had sought to obtain the needed papers through the Saudi Embassy in Washington, but had been directed to the consulate in Istanbul, prompting concerns from his fiancé that he was being lured into a trap, a friend of Khashoggi's said. After going to the consulate in Istanbul, he was told to return another day, two other individuals said. It was on that return visit that Khashoggi disappeared, they said.

Fellow Saudi critics said the disappearance of a man who once was close to Saudi Arabia's most powerful men was a sign of a worsening crisis in the Gulf kingdom.

Madawi Al-Rasheed, a professor at the London School of Economics and a leading voice of Saudi opposition, said the country had "entered a new phase of terror" after Khashoggi's disappearance, which she described on Twitter as a "possible assassination."

Yahya Assiri, a prominent Saudi dissident based in London, said the world should take the incident seriously.

“Otherwise MBS will continue to assassinate anyone who he doesn’t like — Saudi dissident, international journalist or maybe any other diplomat,” he wrote via Twitter messenger, using a common acronym for the crown prince.

Turkey requested permission from Saudi Arabia to search the consulate on Monday, after Turkish President Tayyip Erdogan said he was personally following the case.

During a trip to Hungary, Erdogan later said Saudi officials needed to prove Khashoggi had left the consulate building.

On Sunday, he said authorities were looking into all camera records and monitoring incoming and outgoing airport transits, but added that Turkey would await the results of the prosecutor's investigation.

Late Monday afternoon, U.S. President Donald Trump commented on Khashoggi when asked by a pool reporter if he was concerned about the writer's fate.

"I am concerned about it, I don't like hearing about it, and hopefully that will sort itself out," Trump responded. "Right now nobody knows anything about it, but there's some pretty bad stories going around, I do not like it."

Vice President Mike Pence also weighed in on Twitter, calling the reports about Khashoggi deeply troubling.

Deeply troubled to hear reports about Saudi Arabian journalist Jamal Khashoggi. If true, this is a tragic day. Violence against journalists across the globe is a threat to freedom of the press & human rights. The free world deserves answers. — Vice President Mike Pence (@VP) October 8, 2018

Meanwhile, Assiri warned that if the international community just stands by, other despots could follow bin Salman's lead.

“All dictators have enemies and want to get rid of them. Are we giving them the chance to do it?” he asked.

Like others NBC News spoke to, he said Khashoggi's disappearance was deeply upsetting.

"I am so sad," he added.

Kristina Jovanovski reported from Istanbul; Saphora Smith and F. Brinley Bruton from London; and Dan De Luce from Washington.