Douglas Carswell is a truly exceptional MP. He has never had the slightest interest in holding office. His entire political career has been about advancing the ideas he sees as being in the national interest.

Now you can agree or disagree with his ideas. What you can't seriously do is question his integrity. People often complain that MPs are "in it for themselves", but it is impossible to interpret Douglas's time in politics as anything other than a prolonged act of public service. He is also, for what it's worth, a model constituency representative, an authentic champion of radical, undeferential Essex.

"Ah," you might say, "you're bound to say that, because Douglas is your friend." True. But this works both ways. One of the reasons Douglas is my friend is that he has such a rare sense of decency and principle.

Not every politician has his disinterested patriotism. The MPs who are focused on promotion have evolved a whole vocabulary to describe the MPs who aren't: "headbanger", "obsessive", "fanatic" and so on. All these words, though, are really a way of saying "committed to achieving what he believes in".

Douglas's independence of mind caused occasional clashes in both his parties. His opposition to EU membership put him at odds with the then Tory leadership, as did his championing open primaries, recall mechanisms and the dispersal of power.

In Ukip, paradoxically, it was his absolute commitment to getting Britain out of the EU that caused the problem. Although that was also the main motivation for most Ukip activists, some of the party's MEPs were reluctant to lose their jobs. I heard more than one senior Ukipper talk, before the referendum, of "the SNP option". The ideal result, for this faction, was narrowly to lose the Brexit vote and then, like the SNP after the 2014 Scottish poll, bounce back as the voice of the losing side.

You can imagine how those MEPs and their employees detested Douglas. He was their bad conscience: the politician who was genuinely working for the goal to which they were all notionally committed. His success enraged them. Of the 624 Ukip candidates who contested the 2015 election, 623 lost. Douglas's cheerful brand of patriotism turned out to be a lot more appealing than the England-is-going-to-the-dogs grumbling of the party's national campaign.

When the referendum came, Douglas backed Vote Leave, the campaign that was dedicated to convincing the undecided. His decision was vindicated: Vote Leave won the referendum. The alternative operation, run by an unappealing and egotistical man called Arron Banks, who is now threatening to sue Ukip (he likes threatening to sue, though he rarely actually does) was mainly focused on bigging up the Ukip leadership. Had it secured designation, we'd have lost the referendum.

To repeat, most Ukip members were sincerely committed to getting out of the EU. It was a delight to work with them at street stalls all over the country during the recent campaign. They had shown the strength of mind to leave the traditional party system so as to advance their beliefs; and, almost miraculously, they succeeded. Many of them, like Douglas, will now feel that the job is done.

There is, though, another tendency in Ukip, one which regards the party as an end in itself. These were the people who saw the referendum, not as a chance to leave the EU, but as a chance to promote their party and its leader, even if that made victory less likely. This group takes no pleasure in the win, but continues to express itself through angry accusations. "David Cameron will never deliver the referendum!" "Vote Leave will never win!" "Theresa May will never trigger Article 50!" "It'll never be a proper Brexit!" "We'll still have too many immigrants!" Douglas's very optimism is an affront to them.

Think about it, though. Ukip was founded in 1993 with a sole purpose: to get Britain out of the EU. It has succeeded magnificently. Douglas is now following through the party's own logic. The job is done, he says. Let's award ourselves medals and return to civilian life.

Some will want to keep Ukip going as a sort of anti-immigration or possibly anti-Muslim pressure group, but my guess is that most of that party's voters, and in time members, will follow Douglas. In some cases, they will drift back to the Conservatives, the party that is actually delivering Brexit. In others, they will return to Labour – and will I hope restore a measure of common sense to that party, because Britain needs a decent opposition.

In any event, their place in history is secure. As individuals and as Ukip activists, they helped secure the referendum and then helped win it – two extraordinary achievements. Britain now faces a freer, more democratic and more prosperous future as a globally engaged trading nation. The best is yet to come.

Daniel Hannan has been Conservative MEP for the South East of England since 1999, and is Secretary-General of the Alliance of European Conservatives and Reformists.