RIYADH, Saudi Arabia — The police came for Samar Badawi in the middle of the night in July, pulling her out of her house as she carried her crying 3-year-old daughter.

They set up klieg lights and filmed the arrest of Badawi, 37, a prominent human rights activist. Curious neighbors were forced to sign agreements to never discuss what they had seen, said Yahya Assiri, a Saudi human rights activist and longtime friend of Badawi’s.

The jailing of Badawi, who has been honored by the U.S. State Department and has spoken at the U.N. Human Rights Council, is emblematic of Crown Prince Mohammed bin Salman’s relentless crackdown on those seen as challenging his authority, according to human rights groups.

“He is trying to silence everyone,” said Assiri, who lives in self-exile in London. “There are no human rights defenders still free in Saudi Arabia. They are all behind bars.”

The Oct. 2 killing of journalist Jamal Khashoggi at the Saudi Consulate in Istanbul has focused a harsh international spotlight on Saudi Arabia and forced Riyadh’s allies, especially in Washington, to take a more critical look at the record of Mohammed, or MBS, as the powerful 33-year-old prince is known.

He has been widely lauded, by Saudis and others, as a reformer who has brought long-overdue social and economic change to the kingdom. Young people in particular support him. President Trump has hailed him as a key partner in Middle East peace efforts and in countering Iran’s influence, as well as a deep-pocketed customer for U.S. arms manufacturers.

But the Khashoggi case — and the arrests in the past year of Badawi and dozens of other human rights and women’s rights activists, as well as clerics and even wealthy businessmen and princes — has brought new attention to Mohammed’s record of crushing dissent since he became crown prince in June 2017.

Saudi officials have acknowledged that Khashoggi, who contributed opinion columns to The Washington Post, was killed by Saudi agents. Riyadh describes the killing as a “rogue” operation gone wrong; 18 people have been arrested, and five officials have been fired, including two very close to Mohammed.

But critics, including in the U.S. Congress, are demanding further investigations into whether Mohammed may have ordered a covert action against a journalist who frequently criticized him.

“If there is no punishment for this, they will think they can do anything and nobody can stop them,” Assiri said.

Saudi governments have long quashed criticism, but those efforts have intensified under Mohammed, who has consolidated vast amounts of power, especially over national security, in his hands.

Badawi, who remains in prison without charge, was one of at least eight women’s rights activists arrested earlier this year. Several of them headed a campaign that ultimately led Mohammed to give Saudi women the right to drive — a popular move that won praise from around the world.

It has never been made clear exactly what Badawi’s alleged crime was, or why the others were detained.

In an interview with Bloomberg News this month, Mohammed said those detained were not arrested for their rights activism but because they had “connections” with and were being paid by intelligence agencies from countries such as Saudi rivals Iran and Qatar.

“The evidence and the investigations proved that they did know it was intelligence work against Saudi Arabia,” he said.

Mohammed echoed comments in August from Foreign Minister Adel al-Jubeir.

“These were people who have contacts with outside powers,” Jubeir told reporters, adding that the arrested women had been “trying to obtain information that would be passed on to elements hostile to Saudi Arabia.”

Gen. Mansour al-Turki, spokesman for the Saudi Interior Ministry, said in an interview that Qatar and other rivals, including the Muslim Brotherhood, have a long history of trying to sow discord in Saudi Arabia.

He said he was not familiar with the details of the current cases, but he said Saudi Arabia’s rivals have an “information machine” designed to feed disinformation to Saudis about their leaders.

“We have been faced with this for years,” Turki said.

State-aligned Saudi media called those arrested, who had been campaigning for women’s right to drive, “traitors.” One Saudi paper put photos of two of the women on its front page with the caption: “You & your betrayals failed.”

Human Rights Watch called it “a chilling smear campaign.”

“Paranoia and ruthlessness,” Adam Coogle, the rights group’s Middle East researcher, said in an interview, adding that Mohammed “seems to have utter contempt for human rights and the rule of law, and anyone who is critical is not acceptable to him.”

Ensaf Haidar, wife of Raif Badawi, who is Samar Badawi’s brother and is also in a Saudi prison, for criticizing the government, laughed when asked whether her sister-in-law and the others in jail were paid agents for Qatar or Iran.

“I hear that all the time,” she said in a telephone interview from Montreal, where she now lives with their three children. She said she receives a torrent of abuse from pro-government social media trolls. “It’s just silly,” she said of the spying allegations.

Haidar now travels the world advocating for justice for her husband, for Samar Badawi and for the others she believes have been unfairly imprisoned. But asked in the interview what she thinks of Mohammed, she was silent for a moment.

Samar Badawi is a longtime women’s rights advocate and has been targeted by previous Saudi rulers, although never as aggressively as in the past year, Coogle said.

It is unclear why she is being detained now. She has been virtually sidelined since she signed a pledge in January 2016, after a brief detention, to refrain from public activism. Friends said she agreed to lower her profile to protect her young daughter and teenage son from any trouble.

Her most recent tweet, a week before her arrest, featured pictures of cats.

“I think the stature she had been able to establish bothered them,” Coogle said.

In 2012, Badawi traveled to Washington to receive the State Department’s International Women of Courage Award from then-Secretary of State Hillary Clinton and then-first lady Michelle Obama. Assiri said that global attention surrounding the award was deeply irritating to Saudi leaders.

Badawi’s brother, Raif, perhaps the kingdom’s most famous prisoner, was sentenced in 2014 to 10 years in prison, plus 1,000 lashes in public and a fine of about $250,000, for blog posts that were critical of the country’s powerful religious leaders.

There was a massive international outcry after he received the first 50 lashes in a public square outside a mosque in the city of Jiddah in January 2015. Haidar, his wife, said he has received no more. He remains in prison and is allowed to call his family in Canada once a week for five minutes, Haidar said.

Samar Badawi’s former husband, Waleed Abulkhair, a human rights lawyer, has been in jail since April 2014. He was convicted of “disrespecting the authorities” and “disobeying the ruler” after he criticized the government’s rights record and founded a human rights organization. He is serving a 15-year sentence. They were married and Badawi was pregnant when he was arrested. The couple have since separated.

Although Badawi has been locked in a prison near Jiddah since July, she became the focus of a strange spat between Saudi Arabia and Canada a few days after her arrest.

The Saudi government reacted with unusual fury after Chrystia Freeland, the Canadian foreign minister, called on Aug. 2 for the release of Samar and Raif Badawi, tweeting, “Canada stands together with the Badawi family in this difficult time and we continue to strongly call for the release of both.”

The Saudis recalled their ambassador from Ottawa, expelled the Canadian ambassador in Riyadh and froze trade and investment. In the Bloomberg interview, Mohammed continued his tough line, saying Canada must apologize because it “interfered in issues that are not Canadian issues.”

Badawi has basically been out of the public eye for almost three years.

In January 2015, she spoke to The Post by telephone from her home in Jiddah. At the time, the government of the late King Abdullah had rounded up about a dozen activists, including her husband and brother. She said the Saudi leadership was trying to make an example of them.

“The government wants to send a message to the people,” she said. “If you think like them [dissidents], if you talk like them, you will spend all your life in the jail.”

Asked why she was willing to speak to a reporter under the circumstances, she said that she had to let the world know what was going on in Saudi Arabia.

“I must take this risk,” she said, “and we will hope that they do not do anything to me.”