Northern Ireland was a defining issue for Jeremy Corbyn during his long career as a backbencher. Mr Corbyn the backbencher was a republican supporter. He backed a united Ireland and he prominently identified himself on several occasions with Sinn Féin, with which the Provisional IRA was entwined. He voted against the 1985 Anglo-Irish agreement on the grounds that it strengthened the border between the north and the south. He was consistently outside the Labour party mainstream, which favoured a generally bipartisan approach on Northern Ireland. Nevertheless he voted in favour of the 1998 Good Friday agreement on the grounds that it offered the hope of peace and reconciliation across the divide.

As leader of the Labour party, Mr Corbyn has been more circumspect about the Irish issue. Thursday’s visit to Belfast was his first since his election in 2015. The visit was preceded by a now familiar burst of press indignation after his spokesman confirmed that Mr Corbyn continues to support Irish unification, while stressing that he does so within the framework of the 1998 agreement. The agreement says a united Ireland can only be achieved by the separate and concurrent votes of the two parts of Ireland and that, until this happens, the union of Northern Ireland with Britain is legitimate. But Mr Corbyn’s past record inevitably allowed DUP unionist MPs to taunt him this week with being unwilling to condemn IRA atrocities or meet their victims.

Mr Corbyn has not fundamentally changed his views on many things over the years. So it is hardly surprising that he continues to back a united Ireland or that he refuses to single out the IRA for condemnation. This puts him still outside the Labour mainstream on these issues. It also affects his ability to play a moderating role in Northern Ireland politics, including in helping to resolve the current impasse between the parties, because he is seen as a supporter of one side in the argument. Both he and the Labour party have to live with that.

Yet the reality is that what matters most in Mr Corbyn’s visit to Northern Ireland is less his pro-republican mindset than his approach to Brexit. Mr Corbyn actually said nothing at all in his speech about a united Ireland. When he was challenged about it, his answer was impeccable. He wasn’t asking for a unification poll, he said. He wasn’t advocating it. If there was a wish for a poll in Northern Ireland, it would happen within the 1998 framework. That is what every major UK party leader has said on the issue for the past 20 years. Mr Corbyn is no different. And he is right. If he is to be criticised for the specifically Northern Ireland political content of his Belfast speech it would be for not reaching out to unionists in a way that wrongfoots the DUP.

Right now, though, Northern Ireland is overwhelmingly and pressingly a Brexit issue above all else. Theresa May appears to have recognised that it is not possible to have a hard Brexit and a soft border in Ireland. But she has not yet managed to pull her cabinet together – let alone her party – behind a coherent trade-off between Britain’s market interests, its post-Brexit status and a politically viable timetable. She has rightly ruled out a settlement of the Irish border question that treats Northern Ireland as a special case. So, as Britain’s former ambassador to the EU Sir Ivan Rogers explained in a lecture this week, the least difficult way through – and perhaps the only way – is for the UK as a whole to remain within a customs union with the EU.

Mr Corbyn’s views about the EU have not changed much, any more than his views on Ireland have. This too is a cause of frustration to many. But his speech shows he grasps that the customs union is the pivotal issue in UK politics over the coming weeks. He knows the government is too divided to put forward a coherent plan to amend the Brexit bill. He knows there is a Commons majority for a customs union. He knows that, without a customs union, the Irish border will become hard not soft once it becomes the EU external border. Mr Corbyn’s lifelong hostility to a border may not hold the answer to the Irish question any more. But it may be the key to the Brexit one.