When the police came, Elif was changing her baby's diaper.

She was actually relieved — at least it wasn't a pre-dawn raid, as she'd feared it might be for months. An afternoon arrest, she thought, would be less frightening for her sons.

Elif finished dressing her youngest and watched police search her family's home before they took her into custody — for using a messaging app the government deems seditious.

She knew the arrest was coming. She'd already lost her job, because traces of the app known as Bylock were found on her phone.

But Elif is adamant she never used or downloaded it.

Having Bylock on your phone or even knowing someone who did is to become an instant pariah in Turkey, resulting in isolation, shame, a lost livelihood or worse.

The Turkish government under President Recep Tayyip Erdogan links Bylock with treason, because of the app's alleged connection to followers of Fethullah Gülen, the man the Turkish government believes is behind the deadly 2016 coup attempt. Gülen denies the allegations.

Alleged Bylock users are a large part of the nearly 150,000 Turks detained, arrested or forced from their jobs under state of emergency decrees since the summer of 2016.

Since the attempted coup in 2016, the government of Turkish President Tayyip Erdogan has decreed a state of emergency 6 consecutive times. (Murad Sezer/Reuters)

An estimated 30,000 are believed to be among the innocent swept up in this particular campaign, victims of the chaos, confusion and fear in Turkey.

"Terrifying" is how Tuncay Beşikci describes what people like Elif are living through. The digital forensic expert said they are being "blamed for crimes they did not commit at all."

A former teacher, Elif has been branded a traitor and charged with terrorism. (She asked that we only use her first name to avoid jeopardizing her case and to protect her sons.)

"The thing I want most is to be cleared," Elif said.

And her best chance at doing that are Beşikci, fellow digital expert Koray Peksayar and lawyer Ali Aktaş, who have spent months investigating thousands of cases like Elif's. In so doing, they say they have uncovered a massive cyber-conspiracy.

The Bylock 'trap'

Bylock was a free messaging app used between 2014 and 2016. Available in the Google and Apple app stores for part of that time, it was a less sophisticated version of Whatsapp, but more secretive — you could only communicate with others on the network if you knew their usernames.

This slide shows how the Bylock app worked. (Tuncay Beşikçi) Beşikçi and Peksayar say it was designed by Gülenists to communicate with each other. Beşikçi believes the app was also a way for the organization to surveil its own members.

Beşikçi said Bylock was downloaded roughly half a million times and had 215,000 registered users. About 100,000 of them were identified by the Turkish government as "real users."

Many people downloaded the app willingly, but many who had no traces of it on their phones are also being accused — and Beşikçi and Peksayar have now shown why.

Beşikçi said it was due to a single line of code, which created a window "one pixel high, one pixel wide" — essentially invisible to the human eye — to Bylock.net. Hypothetically, people could be accused of accessing the site without having knowingly viewed it.

That line redirected people to the Bylock server using several other applications, including a Spotify-like music app called Freezy and apps to look up prayer times or find the direction of Mecca. Some people have been accused because someone they shared a wifi connection with was linked to Bylock.

Beşikçi and Peksayar believe it was a deliberate "trap," and allege that the creators were trying to conceal who was and wasn't a member of the Gülen organization after Gülen himself fell out of favour with the Turkish government amid concerns the group was gaining too much power in the state.

Clearing names

Akif Demir, a self-described conservative nationalist, wished the worst on people accused of using Bylock and being associated with the Gülenists. That is, until authorities said he was one of them.

"We were ignorant," the 29-year-old high school teacher concedes.

In October 2016, when his wife was pregnant with their first child, Demir was called into his principal's office. He wouldn't be allowed to work at the school — or anywhere else for that matter — anymore. He had been deemed a Bylock user.

School teacher Akif Demir, middle top, was accused of being a Bylock user before later being cleared. (Submitted by Akif Demir)

"If they said, 'Write a script about the worst-case scenario about your life,' I could never have imagined this, that I would be accused of being a member of a terror group," Demir said.

He handed over his phone and made a statement to police even before they came to arrest him, determined to prove his innocence. When he was questioned, Demir said police asked him about a single phone call placed a year earlier.

He searched his memory — it was a real estate agent he'd called when looking for his first home with his wife. That agent was also accused of using Bylock.

Months later, with no progress in his case, Demir's wife found social media messages Aktaş, Beşikçi and Peksayar had been spreading, telling potential victims they may be able to clear their names. Demir sent them a video pleading his case, along with proof from Google — purchases in the app store showed he had downloaded a prayer time app that experts were showing was linked with Bylock.net.

A rare admission

The Turkish government and the country's courts rarely admit they are wrong, but in December, they revealed the gravity of the mistake they'd made by publishing a list of 11,480 mobile phone numbers. Each number represented a person wrongly accused of terrorism in the Bylock affair.

Demir's phone number was on the list. He considers himself lucky.

Some, including Tayyip Sina Dogan, sat in prison for months. The helicopter technician was on the helicopter that transported President Erdogan as the coup unfolded in July 2016. He has only just returned to his post.

Beşikçi said the severity of the accusations pushed some to attempt suicide.

Islamic preacher Fethullah Gulen has been blamed for inciting Turkey's 2016 coup attempt. Gulen followers are thought to be behind the Bylock app. (Selahattin Sevi/Zaman Daily via Cihan News Agency/Reuters) "Some called me at midnight crying, begging me, because we were the only ones listening to them," Beşikçi said. "We convinced them. We told them we're working on it."

Others could not wait. There are reports that four people on the list took their own lives before they could be exonerated.

Aktaş said Bylock "was seen as a definitive, important piece of evidence" in the hunt to weed out Gülenists. Accepting Bylock cases was dangerous; any more than six at a time would have put him in jeopardy, Aktaş said.

Aktaş, who is based in Antalya on Turkey's Mediterranean coast, describes an atmosphere "where everyone was suspicious of everyone else," pitting neighbour against neighbour, sibling against sibling.

"There was no room for argument," with prosecutors and judges, Aktaş said.

The team believes a few factors helped them finally convince prosecutors and judges that so many of the accused were innocent. For one, there were concerns people within the government were being falsely accused.

Beşikçi was already an accredited forensic expert with the Istanbul courts and had connections in the capital, Ankara. Peksayar and Aktaş have connections to a nationalist party in Turkey; if not close to the government, they're not outspoken voices against it, either.

Relief and fear

Akif Demir is now back at work. After months of driving by his school heartbroken, he said he feels indebted to the team that worked to save him.

While the team is being flooded with calls of thanks and promises of prayers from people now cleared, they're still getting calls and Twitter messages from people still desperate for help.

On the day I was there, Beşikçi said he has about 200 mobile phones in his office to investigate.

Beşikçi is currently investigating countless phones sent to him by people desperate to clear their names. (Nil Köksal/CBC) "We have 81 cities in Turkey — I have victims from each and every city," he said.

Elif has yet to taste the happiness of freedom — her phone number was not on the recent list of wrongly accused.

Her husband, a member of the Turkish navy, lost his job simply because of the accusations against her.

After a week in custody, Elif and her family have been living with her parents in another Turkish city. Like many of the victims, they are surviving on the kindness of family and friends.

"Living in fear is an awful thing," Elif said. "What's going to happen?"

Aktaş thinks the remaining thousands he and the forensic experts believe were wrongly accused will be released eventually. He said the climate in Turkey, at least on this file, is changing.

These people "are owed an apology and compensation," he said.

Payment on those debts, and the release of the innocent, will come, Aktaş said. "Even if it happens late, it will happen."