A man who failed the Massachusetts bar exam because he refused to answer a question about gay marriage has filed a federal lawsuit, claiming the test violated his rights and that his religious beliefs were targeted.

Stephen Dunne, 30, of Boston, is seeking $9.75 million in the suit against the Massachusetts Board of Bar Examiners and the Massachusetts Supreme Judicial Court. He was denied a license to practice law in May after scoring 268.866 on the exam, just shy of the 270 passing grade.

Dunne, who is representing himself in the case, refused to answer a question addressing the rights of two married lesbians, their children and their property, and claims in the suit that it cost him a passing score.

In the suit, Dunne's called the question "morally repugnant and patently offensive," and said he refused to answer it because he believed it legitimized same-sex marriage and same-sex parenting, which is contrary to his moral beliefs.

Dunne claims the Massachusetts state government is "purposely-advancing Secular Humanism's homosexual agenda."

The "disguised mechanism to screen applicants according to their political ideology has the discriminatory impact of persecuting and oppressing (Dunne's) sincere religious practices and beliefs" protected by the First Amendment, and was "invasive and burdensome," according to the lawsuit filed in June.

The suit also challenges the constitutionality of same-sex marriage, which was legalized in Massachusetts in 2003.

Dunne could not immediately be reached by the Associated Press for comment. He told the Boston Herald he has a law degree from a Boston law school, and is currently attending a Boston business school.

He said the bar exam is not the place for questions about same-sex marriage.

"There's a different forum for that contemporary issue to be discussed, and it's inappropriate to be on a professional licensing examination," Dunne told the Herald. "You don't see questions about partial-birth abortion or abortion on there."

The Massachusetts Board of Bar Examiners and the Massachusetts Supreme Judicial Court declined to comment.