The Turnbull government's plan to dilute Australia's race hate laws has been rejected by the Senate.
The proposal to scale back the Racial Discrimination Act's section 18C was voted down 31-28 during a late night session in the Upper House.
Labor and the Greens were joined by the Nick Xenophon Team and Tasmanian senator Jacqui Lambie to defeat the bill.
Cory Bernardi, David Leyonhjelm, One Nation and Derryn Hinch voted with the Coalition in favour of the changes.
Section 18C was added to the Racial Discrimination Act in 1995 by Paul Keating and makes it illegal to intimidate, insult, offend and humiliate on the basis of a person's race.
The government wanted to replace the words "intimidate, insult, offend and humiliate" with "intimidate and harass".
NXT and Lambie disagreed with the wording changes but agreed there needed to be an overhaul of procedure at the Human Rights Commission.
The attorney-general George Brandis warned a defeat would mean the death of freedom of speech and free society in Australia.
"A law like [this] has no place in a free country," Brandis told the Senate.
"As a result of tonight, this law will continue for the foreseeable future in its distorted fashion, limiting freedom of speech to no good purpose while failing to deal with the much more serious matter of harassment.
"Australia alone in the world has failed to come up with a [set of] racial discrimination protections which show that you can protect freedom of speech and you can prohibit racist conduct, and those twos goals are not inconsistent but complementary to one another."
Earlier in the debate Brandis listed all the times he was "deeply offended and insulted" by other senators calling him white.
Alice Workman is a political reporter for BuzzFeed News and is based in Canberra.
Contact Alice Workman at firstname.lastname@example.org.
Got a confidential tip? Submit it here.