Late last year, the Electoral Commission started an investigation into a striking set of circumstances. In February 2016 Steve Baker MP, lobbying for Vote Leave to be designated the “official” leave campaign, sent a round robin email asking recipients to support it, because it claimed to have found a loophole in the spending rules. “It is open to the Vote Leave family to create separate legal entities each of which could spend £700k: Vote Leave will be able to spend as much money as is necessary to win the referendum,” he wrote.

But Baker – now a minister in the Department for Exiting the European Union (DExEU) – got it wrong. The law that protects our democracy from capture appears to make this behaviour illegal: when a sockpuppet signs your cheques, the spending still counts as yours.

The Electoral Commission knew about Baker’s email – it was reported in the Times. But despite knowing that Vote Leave appeared to have contemplated acting unlawfully, the Electoral Commission went ahead and designated it as the official leave campaign.

Q&A Can the Electoral Commission inquiry undermine Brexit? Show Campaigners on either side of the EU debate will have differing opinions on whether any adverse finding on spending calls the result of the referendum into question. However, Jo Maugham, the barrister behind the Good Law Project, said any illegal spending would undermine the result, adding to concerns about Russian meddling and Brexiters failing to deliver promises they made during the campaign. The commission can impose a fine of up to £20,000 for individual rule breaches. Any evidence of more serious offences uncovered in the course of the investigation can be referred to the police if warranted.

Then we come to the referendum campaign. With under a month to go, Vote Leave was bumping up against the limits of what it could lawfully spend. But it had plenty of money left over from wealthy donors.

Of the £6.8m it spent in the referendum, around 40% was with a then obscure digital agency called AggregateIQ. It couldn’t spend more itself; it had a £7m cap, and needed a small safety margin. Breaching that cap could delegitimise the result.

Enter Darren Grimes. Back then, he was a fashion design student with a modest social media presence. He had been closely involved in the Vote Leave campaign. He was in their offices during the campaign, and tweeted a photograph of himself wearing a Vote Leave T-shirt, with Michael Gove..

As Vote Leave’s returns to the Electoral Commission show, it gave AggregateIQ another £625,000. But this time the services were delivered not to Vote Leave but to Grimes. Vote Leave used the same device to pass £100,000 more to AggregateIQ for services notionally provided to Veterans for Britain. Problem solved, it thought. And, after a cursory and inadequate investigation, earlier this year the Electoral Commission agreed.

Enter an unsung hero. Jenna Corderoy, an investigative journalist and transparency campaigner, unearthed a cache of correspondence between the commission and Grimes. It was passed to me, and reading it I was shocked by the quality of the commission’s investigation. It appeared to me to have failed to ask even the most basic facts. So I got together a team of lawyers – Polly Glynn, Jessica Simor QC and Tom Cleaver – and we issued urgent judicial review proceedings.

Earlier this week, the day before it had to file its formal case in the high court, the Electoral Commission caved. A month ago it had asserted our claim was “without merit”. Now, a full 18 months after the vote, it agreed to reopen the investigation. And it asked us to agree to discontinue our high court claim.

But why does all of this matter? If it turns out that Vote Leave executed Baker’s plan, it will have very substantially exceeded the amount of money it was allowed to spend, and will have committed a criminal offence. If so, we cannot know how much difference that illegal spending made to the vote.

But parliament thought overspending could make a difference – that’s why it imposed caps. And wealthy donors thought it could make a difference – that’s why they donated those hundreds of thousands of pounds. And Vote Leave thought it could make a difference – that’s why it appears to have risked criminal sanction to pass those extra hundreds of thousands of pounds to AggregateIQ.

If Vote Leave did commit a criminal offence – and the Good Law Project stands ready to bring a private criminal prosecution if the Electoral Commission will not – then parliament will have to work out how much it cares about the laws it enacted. The thing about an advisory referendum is that it is for parliament to decide what to do with the advice the electorate gives. It may be that parliament once was inclined to take the advice, but new facts may cause it to revisit its value.

Of course, parliament could have gone for a binding referendum, as it did with the vote on electoral reform. But a binding referendum would have come with much stronger safeguards, and a serious breach of spending limits might well have invalidated the result.

It’s not just about Brexit. The reason we have spending limits is because we want to live in a democracy, not a plutocracy. We want all the people to have the power, not just the rich ones. And the Electoral Commission’s job is to protect our democracy: to police those limits, carefully, sentiently, vigorously, without fear or favour.

If it doesn’t do that job, our democracy can’t function. It’s bad enough our democracy should be for sale. But it’s unforgivable for the Electoral Commission to bite the hand it lives to serve.

I am considering the matter with my legal team. But I am unlikely to accept the Electoral Commission’s request that we pull our high court challenge. Our democracy stands on the brink. We cannot afford any institutional failure by the Electoral Commission. I would rather place my trust in the law.

• Jolyon Maugham QC is a barrister and director of the Good Law Project