WASHINGTON (AFP) - The National Security Agency chief said on Tuesday (Sept 13) he was "perplexed" over Twitter's move to block US intelligence from accessing data which may help thwart violent attack plots.

NSA director Michael Rogers made the comments at a congressional hearing in response to Senator John McCain's criticism of Twitter for refusing access to a real-time analytics service called Dataminr.

McCain queried Rogers about a Wall Street Journal report in May that Twitter had blocked intelligence agencies from using Dataminr, which uses algorithms and location tools to reveal patterns among tweets.

The veteran senator said the report indicated that Dataminr had alerted its clients minutes before this year's Brussels attacks and at the time the November Paris attacks began to unfold.

"So we have a situation where we have the ability to detect terror attacks... Yet in order to for us to anticipate these attacks we have to have certain information, and Twitter is refusing to allow them to have certain information which literally could prevent attacks?" the senator who heads the Armed Services Committee asked.

Admiral Rogers replied: "Yes sir, and at the same time (Twitter is) still willing to provide that information to others for business, for sale, for revenue."

He added, "I'm perplexed by their approach in this particular incident... Clearly, I wish I had a better understanding, and perhaps there are insights that I am not aware of."

McCain then said of Twitter: "So shame on them."

Twitter has said it allows both government and business to use the data, as long as it is not for "surveillance" purposes.

Media reports have said that Twitter, which owns a stake in Dataminr, did not want to appear to be too close to US intelligence.

"Dataminr uses public tweets to sell breaking news alerts to media organisations and government agencies, for non-surveillance purposes," a Twitter spokesman said in a statement.

"Due to privacy concerns, we have not authorised Dataminr or any third party to sell data to a government or intelligence agency for surveillance purposes. This is a longstanding Twitter policy, not a new development."

The dispute involving Twitter is the latest between US tech firms and the government over the degree of cooperation in fighting crime and other violence, in view of privacy concerns.

The statement added that Twitter "responds to valid legal process issued in compliance with applicable law, and our most recent transparency report shows over 5,000 US government information requests in 2015 alone."