The Justice Department has charged two former Twitter employees with spying for the Saudi Arabian government, marking the first time federal prosecutors have publicly accused Saudis of spying in the United States.

The charges, unveiled Wednesday in San Francisco, detailed an effort by Saudi officials to recruit employees at the social media company to look up the private data of thousands of Twitter accounts whose users were critics of the Saudi government.

On Tuesday, former Twitter employee Ahmad Abouammo, a U.S. citizen, was arrested in Seattle for allegedly spying on the accounts of three users, one whose posts discussed insider information on Saudi leadership, on behalf of the government in Riyadh, according to the criminal complaint obtained by Fox News.

A second ex-employee, Saudi citizen Ali Alzabarah, was accused of accessing the personal information of more than 6,000 Twitter accounts for Saudi Arabia in 2015, the complaint said. One of the accounts belonged to Omar Abdulaziz, a prominent dissident and friend of Jamal Khashoggi, a columnist for The Washington Post who was beheaded by Saudi government agents last year, as first reported by The Washington Post.

A third person, Saudi citizen Ahlment Almutairi, was also charged with spying after he allegedly acted as an intermediary with Saudi officials and Twitter employees, according to the criminal complaint. Almutairi previously ran a social media marketing company that worked with the Saudi royal family.

All three of the former employees stopped working for Twitter in 2015. They are accused of working with a Saudi official who leads a charitable organization that belongs to Crown Prince Mohammed bin Salman. The criminal complaint alleged that the official, Bader al Asaker, was working at the direction of Mohammed and gave Abouammo at least $300,000 and a watch worth $20,000 for his efforts, according to the court document.

SAUDI ARABIA HOSTS WOMEN'S WRESTLING FOR FIRST TIME AS WWE STARS COMPETE

Alzabarah and Almutairi have not yet been arrested and are believed to be in Saudi Arabia. Neither Alzabarah nor Abouammo’s job duties at Twitter included a need to access a user’s private info, according to the criminal complaint.

Under U.S. law, Twitter can disclose user data to a government entity if there is a life-threatening emergency. Twitter maintains data about its users typically to tailor advertisements to users and recommend content, it has said.

SAUDI ARABIA OPENS TOURISM TO ANCIENT BIBLICAL SITES: 'THE ATMOSPHERE IS CHANGING'

“We recognize the lengths bad actors will go to try and undermine our service," a Twitter spokesperson said in a statement to Fox News. "Our company limits access to sensitive account information to a limited group of trained and vetted employees. We understand the incredible risks faced by many who use Twitter to share their perspectives with the world and to hold those in power accountable."

"We have tools in place to protect their privacy and their ability to do their vital work," the spokesperson added. "We’re committed to protecting those who use our service to advocate for equality, individual freedoms and human rights."

CLICK HERE FOR THE FOX NEWS APP

Crown Prince Mohammed bin Salman, despite his surface-level loosening of repressive restrictions in the kingdom, has increasingly cracked down on critics. The CIA has linked him to Khashoggi's killing in October 2018.