WASHINGTON - A federal grand jury here is investigating a man for allegedly using Twitter to threaten U.S. Rep. Michele Bachmann during her presidential campaign.

U.S. District Judge Royce Lamberth revealed the investigation this week when he ruled against the man's request to quash a grand jury subpoena seeking his identity from Twitter, a social networking site.

In a crude message posted last summer, the man -- referred to in court papers only as Mr. X -- "professed desire to engage in sadomasochistic activities with" Bachmann, the judge wrote.

That alleged threat sparked the investigation, which began in the weeks leading up the Iowa GOP straw poll last August, which Bachmann won. She ended her presidential campaign in early January after finishing sixth in the state's higher stakes presidential caucuses.

Bachmann spokeswoman Becky Rogness declined to comment on the investigation.

Earlier this week, the congresswoman announced her plans to run for re-election even though congressional redistricting pushed her out of the district she represents.

Lamberth wrote that law enforcement agencies have the right to use subpoenas and other tools to gather information from social networking sites to assess threats.

Mr. X's lawyer argued the government did not need to know Mr. X's identity and that his tweets, one of which referenced using a "Vietnam-era machete" in a sex act, were hyperbole and not credible.

Lamberth wrote that the government has a compelling interest in investigating the threats against Bachmann and needed the man's identity to determine if the threat was credible. The grand jury should know if Mr. X has a history of threatening political candidates, or has engaged in threatening behavior toward Bachmann or "happens to own a Vietnam-era machete," Lamberth wrote.

Dismissing Mr. X's Twitter page as vapid, the judge doubted the man would face criminal indictment because there needs to be a "true threat" against Bachmann.

Corey Mitchell is a correspondent in the Star Tribune Washington Bureau.