A U.S. passport. (Thanassis Stavrakis/AP)

William Weaver was denied a passport, authorities say, so he began tweeting threats at the State Department and the CIA.

According to an indictment filed Thursday in federal court in Alexandria, the Herndon, Va., Web consultant submitted a passport application to the State Department in February 2016 and again a year later. Both were denied.

This past summer, according to the indictment, Weaver, 36, tweeted at the agency: "You have about 2 weeks 2 get my passport 2 me before the devices set off and the shotgun blasts start. Tick-tock goes the clock."

He also allegedly tweeted at the CIA: "Logic continues to dictate that bombing the cia, and shotgunning them as they line up outside the gate at work in the morn is my conclusion."

Weaver was arrested last month after trying to buy a gun and ammunition, prosecutors said. He faces several charges of making threats to assault and kill people.

The day before his Sept. 15 arrest, FBI agents say they went to Weaver's house with police and a special agent of the Diplomatic Security Service to tell him that the issue with his passport application had been resolved and that he could try again. The court documents do not say why his applications had been denied.

"I am on a set schedule for some events coming up that your folks should know about. I'm not who I once was," he allegedly responded.

He then went back on Twitter, the indictment says, to make vulgar threats and complain that police and the State Department had been at his door "but they seemed to have forgotten my passport."

He also went to the Herndon police, according to authorities, and then tried to buy a gun and ammunition in Sterling, Va. He was told he could not take the weapon home immediately.

"I tried to buy a shotgun for home defence. VA state police put it on delay," Weaver then tweeted, according to the indictment. "Can't trust police anymore. If denied Will get another way."

He was arrested the next day.

A website listed in the indictment describes Weaver as having worked for 14 years in information technology.

The federal public defender's office, which is representing Weaver, declined to comment.