A friend of murdered Saudi journalist Jamal Khashoggi is suing an Israeli software company he believes helped the kingdom intercept messages sent to him from the dissident criticising Mohammed bin Salman.

Omar Abdulaziz, a Saudi national who now lives in exile in Canada, filed a lawsuit on Sunday against NSO Group alleging its spyware helped the Saudi government gain access to his smartphone.

The spyware allows its customers to secretly listen to calls and read messages on a targeted phone.

The lawsuit, filed in Tel Aviv, accuses NSO Group of breaking international laws by selling its software to oppressive regimes.

"The hacking of my phone played a major role in what happened to Jamal, I am really sorry to say," Mr Abdulaziz said. "The guilt is killing me."

Quebec-based Saudi activist Omar Abdulaziz exchanged messages with Khashoggi in the months before his death credit: YouTube

In messages sent to Mr Abdelaziz, Khashoggi called Crown Prince Mohammed, the de-facto ruler of the kingdom, a “beast” and likened him to a “Pac-Man” who devours everything in his path.

"The more victims he eats, the more he wants," said Khashoggi in one message sent in May, just after a group of Saudi women’s rights activists were arrested. "I will not be surprised if the oppression will reach even those who are cheering him on."

Saudi officials would have been able to see the more than 400 message exchanged between the pair on encrypted apps such as WhatsApp.

Khashoggi and Mr Abdulaziz, 27, who sought asylum in Montreal, began to talk about plans to form an “electronic army” of young Saudis living in the country to try to undermine the government’s online propaganda, according to messages seen by CNN.

Saudi Arabia's King Salman bin Abdulaziz Al Saud meets with British Foreign Secretary Jeremy Hunt, in Riyadh credit: Reuters

In early August, Mr Abdulaziz discovered the Saudi government was aware of their project.

"How did they know?" asked Khashoggi in a message. "There must have been a gap," says Mr Abdulaziz.

Three minutes later Khashoggi writes back: "God help us."

Khashoggi was killed two months later on Oct 2 in the Saudi consulate in Istanbul.

The CIA has concluded that the murder of the Washington Post columnist was ordered by the crown prince himself.

Mr Abdulaziz revealed last month that researchers at the University of Toronto's Citizen Lab reported his phone had been hacked by military-grade spyware.

According to them, the software was the invention of NSO Group, and deployed at the behest of the Saudi Arabian government.

NSO Group has previously faced lawsuits from citizens from Mexico and Qatar, who say the technology was used to hack their smartphones.

The human rights group Amnesty International has also recently accused the NSO Group of helping Saudi Arabia spy on a member of the organisation’s staff.

In a statement, the group says its technology helps governments fight crime, and is fully vetted and licensed by the Israeli government.

"Our products have a long track record of assisting governments in preventing suicide bombers, stopping drug lords and sex traffickers, and helping safely return victims of kidnapping," the statement said.

"If there is suspicion of misuse, we investigate it and take the appropriate actions, including suspending or terminating a contract.”