Massachusetts Chief Justice Margaret Marshall, who wrote the ruling which made the state the first to legalise gay marriage, is retiring.

Ms Marshall, 66, announced her retirement today, saying she was stepping down to care for her husband Anthony Lewis, a former New York Times columnist who has Parkinson’s disease.

Her best-known – and to some, notorious – decision was to legalise gay marriage in 2003 in a 4-3 decision.

She wrote that the state’s ban on same-sex marriage “works a deep and scarring hardship on a very real segment of the community for no rational reason.

“It cannot be rational under our laws, and indeed it is not permitted, to penalise children by depriving them of state benefits because the state disapproves of their parents’ sexual orientation.”

She was accused of being a judicial activist and Kris Mineau, president of the anti-gay Massachusetts Family Institute, welcomed her resignation, telling AP he hoped the state would eventually have a referendum on her ruling.

Since Ms Marshall’s ruling, five more US states have followed suit to allow gay couples to marry.

Born in South Africa, she was the first immigrant and first woman to lead the state’s 320-year-old Supreme Judicial Court.

She became Chief Justice in 1999, after being appointed to the bench in 1996. Prior to this, she was the vice president of Harvard University.

She is to leave at the end of October.