BAE, Britain’s biggest arms company, secretly sold mass surveillance technology to six Middle Eastern governments that have been criticised for repressing their citizens, the BBC has reported.

The sophisticated technology can be used to spy on a huge number of people’s emails and mobile phones, triggering accusations from human rights campaigners that it is being used to silence or jail dissidents.

According to documents obtained by the BBC, the equipment has been sold in recent years to the governments of Saudi Arabia, UAE, Oman, Qatar, Algeria and Morocco.

The documents also reveal official concerns that the export of the technology could backfire and imperil the security of Britain and its allies, the BBC said.

BAE said it was unable to comment on specific contracts “due to the strict national security and confidentiality regulations we operate under”. The manufacturer disputed some of the BBC’s claims without specifying which ones. It added that it was committed to “operating ethically and responsibly”.

According to a BBC investigation published on Wednesday, the sales of the controversial technology were made through a Danish company that BAE bought in 2011.

The firm, now known as BAE Systems Applied Intelligence, sells a surveillance tool that, according to the BBC, can collect, catalogue and analyse millions of people’s electronic communications.

The BBC quotes an anonymous individual who it says used to work for the firm, describing the technology: “You would be able to intercept any internet traffic. If you wanted to do a whole country, go ahead. You would probably need something to narrow your search down, either by a specific person, a specific email address, specific IP address or specific keywords to search for.”

The individual said the technology – which has been called Evident – can be used to pinpoint people’s location based on the data emitted by their mobile phones.

According to the BBC, the technology is capable of breaking communications that have been encrypted, although no details are specified.

This has worried Whitehall officials, according to the emails recording discussions between Danish and British departments responsible for overseeing exports.

In 2015, a British official wrote that if the UK had been asked to approve the export of this technology, it would have refused on the grounds that it could damage the security of the UK and its allies. It was feared that the technology could be used decrypt and read the UK’s own sensitive communications.

However, the Danish government approved the export, partly because its own intelligence service and foreign affairs advisers had not objected.

The BBC reported that it had located two men who were employed to operate the Evident surveillance system in Tunisia during the dictatorship of President Zine al-Abidine Ben Ali. Many opponents were locked up, and tortured, by his regime – one of the Arab world’s most repressive – before he was overthrown in 2011.

One of the men is quoted telling the BBC that his job was to monitor Tunisia’s internet using an Evident system that had been installed in the basement of one of Ben Ali’s houses. “The tool works with keywords. You put in an opponent’s name. You will see all the sites, blogs, social networks related to that user,” he said.

According to the BBC, the second man was part of a specialist intelligence unit that worked closely with Ben Ali. “Sometimes they would ask me to get information about specific people … some information used to go directly to the president. Most of this was about his opponents.”

The BBC said that during its investigation, conducted by its Arabic service in collaboration with the Danish newspaper Dagbladet Information, it had approached the Middle Eastern governments for a comment and received no response.

BAE said: “Our technology plays a crucial role in enabling the UK and its allies to combat the threat of international terrorism, supporting law enforcement and helping to keep the public safe, both in the UK and abroad.

“We have robust policies and procedures in place to ensure our international exports to overseas governments are all fully compliant with international export regulations as well as our own strict criteria to evaluate every potential contract.”

• If you would like to pass on information in confidence, you can send a message via the Guardian’s SecureDrop service (see how here).