Legislation governing the compulsory school starting age for children in Northern Ireland is inflexible and unjustified, the High Court has ruled.
A judge also held that a prematurely born four-year-old boy's human rights could be breached if he is forced to begin classes in September.
Mr Justice Scoffield urged the Department of Education to try to reach an agreement with the child's family before the new term.
Northern Ireland's starting age for pupils is the currently lowest in Europe.
The boy at the centre of the case was born prematurely on July 1, 2017, with his fourth birthday falling on the latest possible date for entering P1 in September.
His parents strongly believe he is not ready and that enrolment should be put back by 12 months.
Despite former Education Minister Peter Weir expressing sympathy with the family's situation, the Department insisted nothing can be done because the Education and Libraries (Northern Ireland) Order 1986 does not permit any such deferral.
Urgent judicial review proceedings were launched after a request for the boy to be allowed to commence school in September 2022 was refused.
Lawyers for the boy argued that it was an arbitrary and unfair situation where the start date would be put off by 12 months if he had been born just a day later.
They claimed the decision is incompatible with rights to private and family life under Article 8 European Convention on Human Rights.
The Department's legal representatives told the court that while legislative reform is necessary and a priority, further work is still required.
Ruling on the challenge, Mr Justice Scoffield said: "The statutory scheme which is impugned in these proceedings is disproportionate in its operation by reason of its lack of flexibility and, thus, its incapacity to deal adequately with a case where requiring a child to commence full-time education at the current compulsory school starting age is clearly and demonstrably contrary to that child's best interests and unjustified by the aims pursued by the present legislation."
He described a report prepared by an educational psychologist dealing with the potential impact on the boy as inconclusive.
"There is at least a real risk that requiring the applicant to commence school in September would be in breach of his Convention rights," the judge said.
However, no finding was made that the child's rights will actually be violated if he has to start in two months time.
"As matters stand, I am not able to reach a clear conclusion on whether this would or would not be in the applicant's best interests for the reasons set out," the judge added.
"I direct the parties to liaise further, with a view to reaching a consensual position on this issue. Failing which the court may require to hear further evidence."
Outside court the boy's solicitor, Ciaran Moynagh of Phoenix Law, welcomed the judicial declaration.
"Northern Ireland has the lowest starting age in Europe and at present a parent has no way of seeking a deferral of Primary 1, no matter how compelling their reasons are. This is certainly not in the best interests of the child," he said.
Mr Moynagh went on: "Today will be good news for those vulnerable children that have a summer birthday and are simply not ready to commence formal education due to birth prematurity, special education needs or other justifiable reasons.
"We very much hope the Department of Education will now expedite a system that is fair, equitable and works in the best interests of children in Northern Ireland."