Abbas Hakimzadeh's jail cell was bleak. High walls, one sink and a window. Just enough light crept in to distinguish between morning and night.
This was solitary confinement in Iran in 2009. The government was in the thick of the largest crackdown on political dissent since the 1979 revolution, jailing scores of protesters, intellectuals, and journalists.
SPY MERCHANTS: MORE FROM THIS PROJECT
Hakimzadeh spent 120 days living like this, not seeing family or friends - just prison guards and interrogators, who occasionally beat him.
Publishing a student newsletter critical of then-President Mahmoud Ahmadinejad at Amirkabir University in Tehran had seen the computer science student thrown into jail.
"The guards lined us up against the wall, put blindfolds on us and we waited for them to take us to our cells," Hakimzadeh, now 34, told Al Jazeera.
"A soldier came up from behind me, cursed me several times, saying he'd beat the hell out of me.
"I was taken to the interrogation room. For two or three hours they beat me. They kicked and punched me in my face, in my legs and in my back."
Illegal trade dealings
During his detention, it became apparent the government had been snooping on him for some time. They had managed to hack both his email and phone.
... surveillance and restrictions and monitoring are not only systematic, but the consequences of being caught speaking your mind can be death.
"In these interrogations, I understood they already had … every email I had," he said, adding they had also accessed text messages and chat applications he had used.
Iran is one of many countries that uses increasingly powerful spyware to quell the voices of political dissidents.
In "Spy Merchants", a new investigation by Al Jazeera, our undercover reporter worked for four months posing as a buyer for clients from countries including Iran and South Sudan - subjects of international sanctions - purchasing the kinds of surveillance systems that ensnared critics like Hakimzadeh.
The investigation exposes illegal trade dealings that could put millions of citizens at risk of privacy violation today, as well as putting dissidents in vulnerable positions.
"Anyone who has looked at Iran, at the young population, can understand the enormous pressure and fear that they live under in a country where surveillance and restrictions and monitoring are not only systematic, but the consequences of being caught speaking your mind can be death," said Marietje Schaake, a member of the European Parliament.
More than half a decade since Hakimzadeh's imprisonment, the global surveillance industry is flourishing.
While the so-called Arab Spring uprisings demonstrated the power of popular protest, they also provided a gold rush for the global surveillance industry.
"We had actual victims coming from Libya, from Syria, who had survived torture, detention and saying this was the cause of my arrest; 'They wouldn't have identified me they wouldn't have tortured me if they hadn't been able to monitor my communications'," Clemence Bectarte, a lawyer with the International Federation of Human Rights, told Al Jazeera.
The technology government leaders used to crack down on protest organisers and contain the spread of revolution, more often than not, came from outside their borders, from countries such as the United States , Italy, Germany and the UK .
"I found that activists, students, journalists, opposition figures in North African and Middle East were targeted, and sometimes imprisoned, as a result of these systems coming from Europe and I found that unacceptable then, and I find it unacceptable today."
And as Al Jazeera's Investigative Unit reveals in Spy Merchants, spyware companies today are illegally selling powerful equipment to governments which continue to persecute dissent - thousands of citizens could still be at risk.
Companies are breaking the law by selling and exporting surveillance equipment powerful enough to spy on entire populations to countries like Iran, but vendors circumvent sanctions and export rules.
These are powerful devices which can intercept, record and otherwise interfere with people's communications.
The backroom deals of such technologies are often difficult to quantify.
Al Jazeera's Investigative Unit, however, has revealed how extremely invasive spyware, which can also intercept the electronic communications of a city, can be bought on the "grey market" by repressive governments.
Spy Merchants exposes the negotiation of several illegal, multi-million dollar deals that breached international sanctions, including a proposed deal to supply highly restricted surveillance equipment to Iran.
Rights groups and privacy experts say they are concerned that IMSI-catchers or IP-intercept systems are being sold to authoritarian governments.
An IMSI-catcher is a portable device that allows its users to track and snoop on multiple mobile phones, with the ability to allow its user to send fake messages from your contacts.
An IP-intercept system has the capability to snoop on data sent over the internet, track who is clicking on certain websites and - by using particular keywords - can accumulate your entire internet history.
Such a system could be employed to monitor an entire country's internet traffic.
"These are not designed to be the simple bugs that you stick under the table to record a conversation," said Claire Lauterbach of Privacy International. "These are powerful devices which can intercept, record and otherwise interfere with people's communications."
Systems to search for political dissidents
Syria has also bought heavily into surveillance technology.
In 2009, aware of growing dissent before civil war tore through the country, Syrian President Bashar al-Assad sought to enhance his country's surveillance capabilities.
Basically, the system they needed wasn't going to be used to look for criminals. It was going to be used to search for political dissidents.
Syrian contractors contracted AREA, an Italian surveillance hardware and software company, to bolster their arsenal of spyware.
A former AREA employee-turned-whistle-blower, who requested to remain anonymous, disclosed the murky inner workings of the deal to Al Jazeera.
He was told the 13 million euro ($13.7m) system was a civil project bought to assist in criminal investigations.
But on a trip to Damascus, he realised the nefarious intent of the potential deal.
"Once we landed, we found some people waiting for us," the whistle-blower recalled. "They belonged to the Syrian intelligence service. They needed to know the identities of the individuals who could be the first ones to start the uprising against the regime. Basically, the system they needed wasn't going to be used to look for criminals. It was going to be used to search for political dissidents."
He alerted AREA's management, but was rebuffed and told the company wasn't responsible for how the system would be used. Instead, he went to the media .
Public protests followed, and AREA withdrew from the project. At the time, the company claimed that they had a valid export licence to supply Syria.
In December 2016, AREA's dealings with Assad caught up with the company, when its Milan headquarters was raided by Italian police, who seized nearly eight million euros ($8.5m) received from Syria. Company executives were accused of falsifying the export documents relating to the Syrian deal. A criminal investigation into the case is ongoing.
"Throughout history, corporations and individuals have profited from war, and the surveillance industry is really just carrying on a tradition there," Julian Richards, an intelligence expert and former Government Communications Headquarters (GCHQ) employee, told Al Jazeera.
South Sudan is also accused of buying invasive spyware.
Since 2013, tribal and political conflict in the country has led to the deaths of tens of thousands of South Sudanese and the government itself has been suspected of human rights injustices.
The bloodshed triggered European Union sanctions and calls for an international arms embargo.
Pagan Amum, former Minister for Peace in South Sudan, was targeted by surveillance equipment purchased by the government.
In 2013, Pagan fell out with President Salva Kiir , which resulted in his arrest. He had been accused of plotting a coup against Kiir. The government used communications that it had intercepted as evidence against him.
"The government, when they interrogated me, and told me that they have recordings of my telephone conversations that would incriminate me, and that they were going to charge me with treason, punishable by death, of course, I could not believe it," Pagan told Al Jazeera. "I was in shock."
As South Sudan's political crisis continues to spiral, Pagan fears the effect that the further supply of surveillance equipment will have on his country.
"The government with that surveillance has reduced the political space for our citizens to speak, the right of freedom of speech has been curtailed, even to speak in private," he added.
Now in Turkey , the Iranian political activist Hakimzadeh remembers feeling under threat - even after he was freed from prison.
About a year after his release, he received a cryptic phone call. The voice on the other end was familiar.
'"You [don't] recognise me?'" the caller said.
"At that moment, I knew it was my interrogator," Hakimzadeh recalled. "I recognised his voice."
The government was still apparently monitoring his movements.
He was later called to the Ministry of Intelligence, where his former interrogator confronted him once more.
"They gave me some of my stuff and spoke with me for a while. He said, 'We have an open file on you. You've misled a lot of people and you have to make up for it now. We'll arrange a series of speeches for you where you can tell students that what you did was wrong.'"
Hakimzadeh refused and was threatened with more jail time. His passport was revoked. He knew the government would not leave him alone.
In the end, he made a drastic decision to escape the surveillance apparatus that had plagued him for so long.
"In the middle of the night, on the back of a donkey, I left Iran and entered Turkey."
Monday, April 10 - 20:00 GMT
Tuesday, April 11 - 12:00 GMT
Wednesday, April 12 - 01:00 GMT
Thursday, April 12 - 06:00 GMT
Friday, April 14 - 12:00 GMT
Saturday, April 15 - 20:00 GMT
Sunday, April 16 - 01:00 GMT
Monday, April 17 - 06:00 GMT
Source: Al Jazeera