(Reuters) - A phone app and a database of more than 50 million voters were key weapons in the successful campaign of cricket legend Imran Khan in last month's general election, though rivals allege Khan also received clandestine aid from Pakistan's powerful military.
How Khan's Pakistan Tehreek-e Insaf (PTI) party used the database and the associated app represents a sea change in the antiquated way in which Pakistan's biggest parties conduct elections, from pre-poll targeting of voters to on-the-day mobilization of supporters.
PTI was secretive about the technology plan ahead of the July 25 poll, fearing rivals could copy it, but several party workers showed Reuters how the app transformed their campaign and gave them an edge.
The phone app proved especially useful in getting supporters to the polls when the government's own telephone information service giving out polling place locations suffered major problems on election day, leaving other parties scrambling.
It partly explains why Khan's party managed to win tight-margin races in the nuclear-armed nation of 208 million people, though Khan's rivals allege he also benefited from the powerful military's support - an allegation he staunchly denies.
"It's had a great impact," said Amir Mughal, tasked with using the app and database, known as the Constituency Management System (CMS), to elect Asad Umar, a lawmaker who won his seat in Islamabad and will be Khan's new finance minister.
The small CMS unit led by Mughal, Umar's personal secretary, was typical of how Khan's party set up teams in constituencies across Pakistan to mine the database, identifying voters by household, zeroing-in on "confirmed" PTI voters, tagging them on the app, and ensuring they turned out on election day.
"Work that would take days of weeks is being completed in one to two hours," Mughal told Reuters in Umar's office minutes after the polls shut.
Khan's PTI surpassed expectations to scoop about 115 seats out of 272 elected members of parliament, while the party of ousted and jailed premier Nawaz Sharif trailed in second with 64 seats.
Developed by a small tech team, the CMS was a key response to Khan's bitter complaints after the 2013 poll loss that his party failed to translate mass popularity into votes because it did not know the "art of winning elections."
Sharif’s Pakistan Muslim League-Nawaz (PML-N) ran a more erratic campaign, hurt by divisions within the party and the loss of key leaders who were either disqualified or in case of Sharif and his daughter, jailed.
Weeks before the elections, Khan sent out a video via WhatsApp urging PTI candidates to embrace CMS.
"I have seen and experienced how it works and I'm using it in all five constituencies I am contesting," Khan said in the video message, seen by Reuters. "The faster you apply this system, the easier your life will become," Khan added.
Created by former U.S.-based real estate businessman Tariq Din and Shahzad Gul, a tech consultant, the early version of the system was not immediately embraced by PTI.
But Umar, the incoming finance minister, and wealthy politician Jahangir Tareen Khan, a close Khan ally, were among the first to see its potential. After the software helped deliver strong results in the 2015 local elections, the party was won over, according to senior PTI officials who work on the CMS software.
For the national election PTI focused on 150 constituencies it felt it had the best chance of winning. Party workers said they used scanning software to digitize publicly-available electoral voter lists to create the database.
By typing in a voter's identity card number into the app, PTI workers could see details such as family home address, who else lived in the same household, and where they needed to vote.
It became so crucial to the PTI campaign that when on election day the program went down for an hour, it triggered some panic in the party’s ranks.
A senior CMS official showed Reuters WhatsApp messages that flooded in when the system ground to a halt under the weight of database searches, which totalled 20 million on election day.
"What the hell is going on?," inquired one of Khan's closest allies. This politician then called the CMS team and made his feelings clear, saying: "If the system doesn't work, we will lose the elections and you guys will be the villains."
When CMS came back up, Khan's ally messaged again: "Thank God."
CMS architects say the system’s power was only partly utilized as there was not enough time to train workers across the country and some politicians resisted using it.
In the run up to election day, PTI workers were also able to print out "parchis," or slips, that voters needed to enter the polling station. PML-N workers had to help voters fill the paper slips with a pen.
In a large nation where illiteracy hovers above 40 percent, that meant PML-N workers had to write out millions of slips for the 12.9 million voters who backed Sharif's party, stopping those workers from canvassing or doing other vital work.
"It's a paradigm shift," said another senior CMS operator. "We changed the party, turning social media popularity into reality."