At a crowded market in the shadow of towerblocks in north-eastern Paris, shoppers gather to take selfies with a smiling, slightly shy, young man in a business suit. “Mounir! A photo with my granny!” shouts one young woman, pushing forward an old lady in north African dress for a hug. “My daughter needs work experience, what do you suggest?” asked a father from the 10th floor of a high-rise, proud of the first child in the family to go to university.

Mounir Mahjoubi, 33, is the youngest member of France’s new government and part of Emmanuel Macron’s inner circle. He is the computer brains and digital campaigner whose online strategy helped the independent centrist Macron secure a decisive presidential election win in May, and who worked to stem a vast hacking attack that hit the final days of the campaign. He is now being held up as one of the faces of the “Macron landslide” – a newcomer to parliamentary politics well-placed to win a seat in the final round of National Assembly elections on Sunday, when the president’s new centrist movement, La République En Marche, is on course to win one of the biggest majorities in the modern French state.

Mahjoubi was born to Moroccan parents in the east of Paris. “Prepare to see new faces in parliament,” he has regularly said on the campaign trail. France, which has a large population with Algerian, Moroccan or Tunisian roots, currently has fewer than a handful of MPs from that background in parliament. He is standing in Paris’s northern 19th arrondissement, a mix of ethnically diverse working-class neighbourhoods and rapid gentrification, where he has lived for two years. He topped the first-round vote last weekend, knocking out the Socialist party leader Jean-Christophe Cambadélis who had held the seat for 20 years, and now faces a run-off against the hard-left movement, France Unbowed.

In voters’ minds, Mahjoubi is still best-known for digital damage-limitation.

Hours before the presidential election, he battled what Macron’s campaign called a “massive and coordinated” hacking attack that cybersecurity research firms suggested might be the work of a Russian-affiliated group. Tens of thousands of internal emails and other documents were released online after months of attempts to hack into email accounts and systems. Mahjoubi claimed to have limited the impact by setting traps of false email accounts for the hackers, saying only mundane messages such as “jokes” or “suppliers’ invoices” had been stolen.

Days later, he was appointed France’s junior minister for digital affairs, in charge of the new government’s internet strategy, from net safety to digital startups.

Every recent French government has had a minister for digital affairs. But none of them was a self-taught geek from a poor immigrant family who as a child trekked across Paris to use free computers in museum foyers, and says the most formative years of his life were those spent as a teenage call centre technician helping fix people’s problems with their internet connections. He is the first minister for digital affairs who, when he found his Arab-sounding name put employers off his CV, instead became a startup entrepreneur, rising to head the country’s digital advisory body and championing inclusive internet access for all, spurred on by his mother’s difficulty in using the internet and inability to book an appointment online.

Mahjoubi on the stump in Paris. Photograph: Laurent Chamussy/Sipa/Rex/Shutterstock

In the back of his ministry car on the way to a weekend meeting in his government department before the first round of the parliament election, Mahjoubi looks out of the tinted windows and reflects on the word geek. He has always described himself as a geek and on the French political scene it has been taken at face-value to mean the computer obsessive that he is. But he also sees geekdom as a kind of outsider status. “It’s about your relationship to the world,” he muses. “The word geek means nerd. People look at you differently; you look at the world differently. Digital contact and going online – that was amazing, it changed my social life.”

Mahjoubi’s parents arrived from Morocco in the 1970s, when his mother was 17. “It was a very working-class family, they arrived with no qualifications. At first they worked as caretakers. Then my mother became a chambermaid in a hotel, my father painted buildings.”

As a child, he was into maths and geometry, the middle child with one sister 10 years older and another 10 years younger. “I heard about this incredible new thing called the internet,” he says, adding how, aged 12, he saw an advert for the Paris science museum where you could try the internet for free. “There were 15 computers and you queued to have an hour free if you bought an entry ticket. I bought an annual pass to the museum and every Saturday and Sunday I’d travel from one side of Paris to the other to get on the internet and see what it was about. I’d go on Yahoo, chat with people on the other side of the world. I didn’t speak great English then so it wasn’t brilliant chat ...”

At 13, he won a young innovators’ competition in the kids’ science magazine, Sciences et Vie, for his design of a new geometry instrument in the shape of a camembert cheese. He used the prize money to buy the cheapest computer he could find – it was flat-packed and he assembled it at home. He spent his spare time coding.

While still at school, aged 16 in 2000, he applied for a part-time job as a call centre technician for Club Internet, the first major French internet service provider. He was so young he needed his mother’s signature on his contract, but he stayed there for eight years, paying his way through a law degree and then a business qualification at the prestigious Sciences Po university in Paris. Later he launched a series of startups based around the collaborative economy, including La Ruche qui dit Oui (the FoodAssembly in the UK) – an online food co-op system that allowed communities to buy direct from local producers.

But throughout our conversation, he returns to his Club Internet call centre days as the period that shaped him the most. “I must have answered 9,000 calls in eight years,” he says. “They’d say: ‘It’s not working. I can’t connect, I don’t understand what’s happening’.”

What did he learn there? “I learned life. Because with 9,000 calls, that’s 9,000 lives you’re stepping into – it makes you humble. You listen, you help. If you didn’t take pleasure in it, you’d die by the end of it, so I took pleasure in it. When you reconnect someone’s emails and they see them reappear, they’re really happy.”

Minister for digital affairs ... Mahjoubi (back left) with Macron (front left) and other members of the new government. Photograph: Philippe Wojazer/AFP/Getty Images

Still a teenager, he took on a key trade union position at the call centre when there was a sudden and “inhuman” switch to automation without consulting staff. “Normally you picked up the phone, said hello and could spend an hour fixing a customer’s problem. Suddenly, from one day to the next, the phone picks up by itself, hangs up by itself, and there’s an alert that says: ‘Watch out, this call is going on too long,’ a superviser that listens in, a chart that says who’s the top-performing technician. Everyone started getting ill, becoming absent. That was because it had been done without consultation. Automation – I’ve lived it so I’m not afraid of it, and I know it can be handled well – but there have to be ground-rules at the start.”

Being a union rep which “really shaped my character,” he says. “I had the edge of someone who had negotiated with the bosses, buyers, judges. You gain a kind of strength.”

His studies went well; he won awards – a public speaking prize, a one-year research-stint at Columbia university in New York, where he ran the French film club. He went to Cambridge for a month as part of a scholarship bringing together international students of all faiths and backgrounds. But he still came up against the age-old problem in France of having an Arab-sounding name on his CV. Even after his business qualification, his job applications were mostly met with silence. He found it easier to startup his own companies.

“It’s not just about Arab-sounding names. Those names often come with a working-class background, and that can mean a CV that is missing the right internships because you don’t know the system well,” he says. “That was my case. I wanted to work for a management consultancy. The recruiter said, ‘Mounir, you don’t have strong internships, strong work experience.’”

He had become a Socialist party member as a student and worked for the presidential candidate Ségolène Royal’s online campaign, known as the “Ségosphere”, and again for François Hollande’s winning campaign in 2012. It was last year, when his digital business success saw him appointed head of France’s national digital council – an independent commission of digital experts who advise government – that he first met Macron, then economy minister. He felt the Socialist party wasn’t sharp enough on helping entrepreneurs. When the pro-business Macron announced he would run for president, Mahjoubi jumped ship to become his digital adviser, saying Macron was “the only person able to create the conditions for really changing France”.

Mahjoubi defines Macron’s digital election campaign by its live-streaming. Macron was the candidate with the most live videos, from campaign rallies to moments such as Macron wading into a crowd of angry workers to debate with them outside the Whirlpool factory in Amiens (closed to the media but broadcast on Facebook live by Macron’s team). “A digital campaign doesn’t replace a physical campaign, it just allows more people to live it in real-time,” Mahjoubi says. A Macron campaign video could get around 4 million views.

The hacking risk was always there, he says, given the hacking of Hillary Clinton’s Democrat campaign in the US: “We knew we were going to be attacked and targeted.” Early on, he says, it was clear that “highly sophisticated” attempts were being made to get access to the campaign’s email accounts, including hackers pretending to be Mahjoubi himself and emailing staff asking them to download supposed documents detailing how to protect accounts. He focused on reducing the risk if anyone managed to break into the system. His digital team put in place traps for hackers, cyber-blurring with false email accounts and false documents, mainly to waste their time and slow them down – which also prevented hackers getting near Macron’s own account or his top aides.

Who exactly hacked the campaign? “We still don’t know – we can never say,” he answers carefully. He maintains his team limited the damage. “There wasn’t much to steal from us, not much information they could get.”

For Mahjoubi, the internet “worsens what is dangerous and dark, and improves what is decent and good”; it’s a “delicate balance”. His first aim as digital minister is access for all, even in rural connection blackspots and among people who feel too old or intimidated to use it, as well as making France’s creaking state administration fully digital and improving business tech.

Macron’s new “neither right nor left” political movement, which needs a majority in the parliamentary elections to be able to carry out his pro-business reforms, has promised to renew and revolutionise the political class.

Does Mahjoubi feel that means people from ethnic-minority backgrounds like himself? He pauses. “What we’ve changed with Emmanuel Macron is all types of diversity – age, social background, career background. Bringing people into government from civil society and the private sector is a revolution. And then me, I stand for diversity on a lot of fronts: age, digital, entrepreneurship and after all that, yes, I have an Arab name, a different type of face. And if that means a child might look at me and say, “One day I could become a minister,” then I’m very happy about that.”