Jack Teixeira, the Massachusetts Air National Guardsman accused of leaking classified Pentagon documents, will remain in custody before his trial, according to a federal judge's ruling Friday.

The 21-year-old allegedly shared classified military documents about the Russia-Ukraine war and various national security issues on Discord

He was arrested in North Dighton, Massachusetts, April 13 after an FBI investigation.

During Friday's hearing in Worcester, Massachusetts, U.S. Magistrate Judge David Hennessy explained his reasoning to keep Teixeira in custody, citing Teixeira's past disturbing online comments and a "fascination with guns."

PENTAGON LEAK SUSPECT JACK TEIXEIRA CHARGED IN FEDERAL COURT, TELLS DAD 'I LOVE YOU'

Jack Teixeira court appearance sketch

Massachusetts Air National Guardsman Jack Teixeira, center, is seated as defense attorney Brendan Kelley stands and speaks, at right. Teixeira's father, Jack Michael Teixeira, is seated in the witness stand during a detention hearing in federal court in Worcester, Mass.  (Margaret Small via AP)

Hennessy also noted that Teixeira was previously admonished by his bosses for not handling sensitive information properly. 

The judge called the alleged leak "a profound breach of the defendant’s word that he would protect information related to the security of the United States."

WHO IS JACK TEIXEIRA, THE AIR NATIONAL GUARDSMEN ALLEGEDLY BEHIND LEAKED CLASSIFIED DOCUMENTS? 

"Who did he put at risk? I mean, you could make a list as long as a phone book," the judge said.

Prosecutors previously argued that America's foreign adversaries might reach out to Teixeira to get more sensitive information from him. Hennessy noted that he found those arguments compelling.

Selfie Jack Teixeira alleged leaker

A selfie of Jack Teixeira, the 21-year-old National Guardsman accused of leaking classified information. (Facebook)

"It doesn’t seem implausible at all that a foreign government would make an overture to this defendant to get information," the judge said.

Prosecutors also noted that Teixeira had a history of making comments about violence. He was suspended from high school in 2018 after a classmate heard him talking about Molotov cocktails and racial threats. His social media also included comments about violence and murder.

Teixeira was also reprimanded by his superiors for viewing information "that was not related to his primary duty and was related to the intelligence field" in October and September, according to internal Air National Guard memos.

Relatives of Jack Teixeira at courthouse

Relatives of Jack Teixeira leave the John Joseph Moakley United States Courthouse in Boston April 14, 2023. (Joseph Prezioso/AFP via Getty Images)

CLICK HERE TO GET THE FOX NEWS APP   

The suspect is accused of initially sharing classified information over a Discord server, which was called Thug Shaker Central. After that, he allegedly sent pictures of classified documents. As a cybersecurity journeyman, Teixeira held a top-secret information security clearance.

The Associated Press and Fox News Digital's Timothy Nerozzi contributed to this report.