I am not indeed surprised that Brazil had legalised homosexuality in 1823. Brazil became independent from Portugal in 1822, when the Portuguese King Peter IV turned himself Peter I, Emperor of Brazil, leaving the Portuguese Throne to his daughter Mary II. Both Peter I and Mary II were very liberal and established some of sort of democracy in Portugal (slavery and the death penalty were abolished by Mary II) and Brazil, perhaps the first Constitutional Monarchies in the modern world. History also tells that Peter I and his son Peter II (last emperor of Brazil) were known to be homosexuals. There is a Gay Bath House in Vienna (Austria) that has been in operation for some 200 years with further 2000 years of History, which states Peter II was one of their VIP customers – it called Kaiserbründl.
In regards to Lula’s attitude towards gay marriage, I cannot imagine the knock on effect it will have in the South American Continent, it will have a huge impact, remember Brazil is a huge country.