Jeremy Corbyn will be a defendant in the legal challenge to his automatic inclusion on the Labour leadership ballot, the high court has decided.

Lawyers for the Labour leader successfully argued he had a right to be heard in the case because his interests were not the same as those of Labour’s general secretary, Iain McNicol, who had previously been the only named defendant in the case brought by a Labour donor. Corbyn and McNicol will have separate legal teams.

The legal challenge, brought by former parliamentary candidate Michael Foster, contests the decision of Labour’s national executive committee to allow Corbyn on the ballot paper without having to secure nominations from Labour MPs.

McNicol was being sued in a representative capacity but Corbyn requested to be added to the proceedings as second defendant.

On Tuesday, high court master Victoria McCloud heard that Corbyn’s “personal interest in the subject matter of this litigation is pressing and obvious and distinguishes him from the general body of members represented by Mr McNicol”.

McCloud said it was clear Corbyn had a personal interest in the case. “The extent to which the court should err towards inclusiveness in an action inevitably depends on the facts but in this case the court finds that Mr Corbyn is a member of the Labour party who is particularly affected and particularly interested in the proper construction of the rules, and his interest in that regard is of a significantly different quality than that of other members,” she said.

“Where, as here, we see that the defendant [McNicol], albeit in a formal representative capacity, is being expected to vigorously defend a position which he regarded as incorrect prior to the NEC decision, and where there has been self-evident suspicion and a lack of trust within the NEC on this issue, a further factor comes into play and that is the public perception of the fairness of the court process.”

Labour’s NEC voted 18-14 in a secret ballot after a tense six-hour meeting that Corbyn, as the incumbent, was not subject to the rule that forces candidates to show they have the backing of 20% of the party’s MPs and MEPs.

Foster, a former showbiz agent who has given more than £400,000 to Labour since 2010, said the party had received contradictory legal advice on the issue and the party rulebook was unclear.

Launching his case last week, he said no member of the NEC was unbiased in their view on the matter, and the rules should be clarified by a neutral judge.

“All I am saying is that the advice that was taken was not given the expert consideration it would receive by a high court judge,” he told the BBC. “Everyone in the room had a different political agenda.”

The full hearing of the case will take place on 26 July, when a court will be asked by Foster to, in effect, reverse the NEC decision “so that Mr Corbyn will not be eligible to stand as a candidate in the forthcoming leadership election unless he secures the requisite number of nominations in the time limited by the rules”.