ON March 3rd a young gay man, Daniel Zamudio, was beaten to a pulp in a park in Chile's capital, Santiago. His assailants carved swastikas on his body. He died in hospital three weeks later. Four men, alleged to have ties to a neo-Nazi group, have been charged with his murder. But the public outrage over Mr Zamudio's fate has had wider consequences: having languished in Congress for seven years, an anti-discrimination law has been hastily approved.

Chile has never been an easy place for homosexuals. The Catholic church maintains a formidable, if waning, grip on public morality. Divorce was banned until 2004, and gay sex decriminalised only in 1999 (in Argentina and Brazil it has been legal since the 19th century). Chile is one of only four countries in South America where the age of consent is higher for gays than for heterosexuals. In March the Inter-American Court of Human Rights berated the country for denying a lesbian mother, who was also a judge, custody of her three daughters. In 2004 the Supreme Court had ruled that it would be detrimental to the girls' development to stay with their mother because she lived with another woman.

But attitudes seem to be changing at last. President Sebastián Piñera, an economic conservative but a social liberal, has boldly promoted gay rights, despite distaste from within his own coalition. He surprised many in 2009 by including openly gay couples in his campaign commercials. He invited gay activists to attend his state-of-the-nation address on May 21st. In this year's census, for the first time those Chileans who live with a gay partner can register the fact.

For years Chile's homosexuals have gazed enviously over the Andes to Argentina, where sexual attitudes are more relaxed and where gay marriage is legal. It will be a while yet before Chile follows suit. But Mr Zamudio's horrible fate has helped to make the country a bit more tolerant.