Wikipedia will take legal action against the National Security Agency and the US Department of Justice challenging the government’s mass surveillance programme.

The lawsuit, to be filed on Tuesday, alleges that the NSA’s mass surveillance of internet traffic in the United States – often called “Upstream” surveillance – violates the US constitution’s first amendment, which protects freedom of speech and association, and the fourth amendment, which protects against unreasonable search and seizure.

The NSA’s Upstream surveillance scheme captures communications with “non-US persons” to acquire foreign intelligence information.

“By tapping the backbone of the internet, the NSA is straining the backbone of democracy,” Lila Tretikov, executive director of the Wikimedia Foundation wrote in a blog post.

“Wikipedia is founded on the freedoms of expression, inquiry, and information. By violating our users’ privacy, the NSA is threatening the intellectual freedom that is central to people’s ability to create and understand knowledge.“

The NSA’s current practices exceed the authority granted by the Foreign Intelligence Surveillance Act that Congress amended in 2008, Wikimedia said.

“We are asking the court to order an end to the NSA’s dragnet surveillance of internet traffic,” Wikipedia founder Jimmy Wales wrote in an opinion piece in the New York Times.

Wikimedia and eight other organisations filing the lawsuit, including the Human Rights Watch and Amnesty International USA, will be represented by the American Civil Liberties Union.

Major US technology companies suffering from the fallout of NSA’s mass surveillance programs are uniting to shore up their defences against government intrusion.

The NSA and the DoJ were not immediately available for comment.