A Roman Catholic high school student celebrated Friday after a judge ruled that the teen has the right to take his boyfriend to an end-of-the-year dance.

The decision came only hours before the prom was scheduled to begin in Oshawa, Ont., just east of Toronto.

"I feel at ease now just knowing that we're getting free of discrimination," said Marc Hall, 17, sporting a white tuxedo and blue hair as he prepared to hop in a limousine with his boyfriend.

Ontario Superior Court Justice Robert McKinnon granted the student's request for an injunction against the Durham Catholic District School Board.

"The idea of equality speaks to the conscience of all humanity dignity and worth," McKinnon wrote in his ruling.

"Marc Hall is a Roman Catholic Canadian trying to be himself. He is gay. It's not an answer to Section 15 Charter rights on these facts to deny permission to attend a school function to celebrate the end of his high school career with his classmates."

Hall said he's not worried about encountering anyone at the prom who might be upset about the judge's decision.

"Most them support me anyway, so I'm just going to go have fun with them," he told reporters.

Hall launched the case after officials told him not to bring his 21-year-old boyfriend to the dance at Monsignor John Pereyma Catholic high school.

Officials acknowledged that Hall has the right to be gay, but said permitting the date would send a message that the church supports his "homosexual lifestyle."

The board had argued that allowing a gay student to bring a date to a Catholic function is "not consistent with teachings of the church." Officials told McKinnon that if Hall doesn't accept the faith's beliefs he could always go to a public school.

But Hall said his rights were being violated because the ruling was based solely on his sexual orientation.

His lawyer, David Corbett, argued that the school board doesn't have such sweeping powers under the Constitution. He said the ban contravened the Ontario Human Rights Code, the Education Act, and the provincial Code of Conduct.

The school board said it's disappointed by Friday's decision, but will abide by the judge's ruling. It also plans to keep fighting in court.

Hall said he, too, is ready for any appeal.

"I'm prepared to take it to trial in order to set a precedent so that nobody else will have to go through what I had to go through," Hall told reporters.