MSPs have passed Scotland's controversial new hate crime law.
The legislation consolidates existing law and extends protection for vulnerable groups with a new offence of "stirring up hatred".
It was passed by 82 votes to 32 a day later than expected, after MSPs ran out of time on Wednesday while debating a raft of amendments.
Opponents of the bill said they still have concerns about a possible chilling of free speech.
There were four abstentions.
Justice Secretary Humza Yousaf said: "I am delighted Holyrood has backed this powerful legislation that is fitting for the Scotland we live in.
"Parliament has sent a strong and clear message to victims, perpetrators, communities and to wider society that offences motivated by prejudice will be treated seriously and will not be tolerated."
The Hate Crime and Public Order (Scotland) Bill was first introduced last April in response to an independent review of Scotland's hate crime laws by Lord Bracadale, but has sparked fierce debate.
Under the bill, offences are considered "aggravated" - which could influence sentencing - if they involve prejudice on the basis of age, disability, race, religion, sexual orientation, transgender identity or variations in sex characteristics (sometimes described as "intersex" physical or biological characteristics).
It also creates new offences of "stirring up hatred" - which previously applied only to race - and abolishes the offence of blasphemy which has not been prosecuted in Scotland for more than 175 years.
An earlier draft of the bill was criticised by the Law Society of Scotland for having a perceived low threshold for prosecution.
A number of groups including religious and cultural groups, writers, journalists, campaigners and police raised concerns about its impact on free expression.
The Scottish government responded by modifying the wording and strengthening freedom of expression provisions.
The changes meant "stirring up hatred" would only be considered an offence if it was intentional.
On Wednesday, two amendments designed to further strengthen the protection of free speech were passed unanimously by MSPs.
During the final debate on Thursday, Humza Yousaf argued that those provisions were strong enough to prevent criminalisation.
He said: "To those who think they may accidentally somehow fall foul of the law... because they believe sex is immutable, or they believe an adult man cannot become a female or they campaign for the rights of Palestinians... or those that proselytise that same-sex relationships are sinful, none of these people would fall foul of the stirring up of hatred offence for solely stating their belief - even if they did so in a robust manner.
"Why? Because solely stating any belief, which I accept may be offensive to some, is not breaching the criminal threshold.
"This bill makes clear that we are listening to the victims of hate crime."
It was described in a heated five-hour debate as "the most controversial" piece of legislation ever considered by the Scottish Parliament.
From its troubled beginnings, the Hate Crime Bill has been altered significantly. Changes were made during cross-party efforts in what some MSPs described as "Holyrood at its best".
Yet even with that scrutiny, concerns remain. Offences can now be committed even in private, an abandonment of an earlier "dwelling defence" in race hate law.
Even with the Scottish government's insistence that the bar for prosecution is high, there are those who still believe this is an example of interference in private and family life. Why should any government, they ask, decide what can and can't be said in the privacy of one's home?
What is the difference, though, if one intends to encourage others into action against a vulnerable section of the community, whether that encouragement is in public or in private? That's the position of the Scottish government.
And then there is the issue of sex. Some - including Labour's Johann Lamont - say the bill should have done more to protect women. She referred to the violence and abuse women suffer at the hands of men.
This debate goes to the heart of how individuals identify themselves and asks how the authorities might permit them to discuss their place in society. MSPs have found themselves trying to strike a delicate balance between freedom of expression and freedom from persecution. Have they succeeded? Opinions vary.
So, having said all that, what does all this actually mean for you? Well, it depends on who YOU are and - crucially - how you're defined by this new law.
However, Scottish Conservative justice spokesman Liam Kerr said there was "inherent ambiguity" in the language of the legislation.
He claimed it did not strike the right "balance" between free expression and protection from hate.
Another amendment from MSP Johann Lamont that would have included women as a protected group under the legislation was defeated.
The government has instead set a working group to look at whether misogynistic abuse should be a separate crime.
This group, led by QC Baroness Helena Kennedy, is due to report within a year.
Scottish Labour's Neil Bibby agreed with Ms Lamont that the legislation was "flawed" because sex was not included as a protected characteristic.
However he said we "ultimately have to recognise this bill will give protection to minorities".
He said: "It makes sense that we should seek to consolidate, modernise and reform Scotland's hate crime laws. We need this bill because hate crime has become more widespread. Society has become more polarised and divided."
Liberal Democrat MSP Liam McArthur also said he thought it was "anomalous" to leave out sex as a protected characteristic.
He said his concerns had "not wholly disappeared" but he had been "persuaded on balance" to vote for the bill.
MSP John Finnie from the Greens dismissed suggestions from opponents that family dinners could be "ruined by a flurry of arrests" if people made controversial comments.
He said: "The bill, like others, is about balance, and I think the balance between the freedom of expression and the right to private life has been struck by this bill, and countless organisations agree."