Mr Justice Scoffield delivered the declaration at the High Court in Belfast.
His ruling came Belfast man Sean Napier brought judicial review proceedings into the lawfulness of the DUP move.
The case centred around DUP leader Sir Jeffrey Donaldson’s announcement last month that his party would boycott the North South Ministerial Council (NSMC) meetings as part of their campaign of opposition to the NI Protocol.
Mr Justice Scoffield said: “The respondents’ decision to withdraw from the North South Ministerial Council was, and is, unlawful.
“It frustrates, is contrary to and is in breach of legal duties contained in part five of the Northern Ireland Act 1998.”
He said that wording of the declaration had been agreed by legal counsel for both the applicant and the respondents.
Mr Justice Scoffield said: “The statutory scheme, consistent with the Good Friday Agreement, is set up to ensure that an appropriate minister must participate in the North South Ministerial Council, or at least nominate some other minister to participate in their place.
“The evidence clearly suggested that individual DUP ministers had neither been attending nor nominating another designated unionist minister to attend in their place.
“A situation where North South Ministerial Council meetings are unable to proceed because of the circumstances above is, in my view, plainly a result of unlawful behaviour.”
The judge added: “Ministers of the Northern Ireland Executive are required to affirm the pledge of office, set out as part of the Northern Ireland Executive Ministerial Code.
“That includes a commitment to participate in the North South Ministerial Council and the British Irish Council.
“It is difficult for the court to reach any other conclusion than that the respondents have consciously determined to act in contravention of the pledge of office and the ministerial code.”
Mr Justice Scoffield pointed out that the decision not to attend the north-south meetings was under direction from the DUP leader.
He added: “It is perhaps worth emphasising the each minister of the Northern Ireland Executive bears personal responsibility to comply with the pledge of office and the ministerial code.
“The court expects the respondents to comply with their legal obligations.”
Mr Justice Scoffield said he would not take any further action at the moment, but said if there was no change to the situation the applicant could return to court.
“The court obviously possesses further powers. But, in my view, it would be a sorry spectacle for those powers to have to be invoked.”
Mr Napier’s lawyers had argued the decision to boycott the meetings is frustrating the function of government and could jeopardise peace funding.
They also argued that the policy breaches constitutional arrangements under the Northern Ireland Act 1998 and violates the Stormont ministerial code and the pledge of office.
Two NMSC meetings have already been cancelled, with further meetings scheduled for later this week.
There is a meeting later this month to agree a €1 billion PeacePlus funding between the Stormont Executive and the Irish government.
Five DUP ministers were named as respondents in the case, First Minister Paul Givan, junior minister at the Executive Office and Foyle MLA Gary Middleton, Education Minister Michelle McIlveen, Agriculture Minister Edwin Poots and Economy Minister Gordon Lyons.Tags: