Nicola Sturgeon has said transphobia within the SNP is "not acceptable" amid reports that large numbers of party members are leaving over the issue.
The SNP leader said transphobia should be treated with zero tolerance in the same way as racism or homophobia.
The party has been embroiled in a deeply divisive debate about plans to make it easier for people to change their legally-recognised gender.
Some senior SNP figures have openly criticised Ms Sturgeon over the move.
They are concerned about the potential that allowing people to self-identify their gender would have on women's rights in areas such as single-sex changing rooms, and women-only shortlists.
But the row, which has been particularly fierce on social media, has led to accusations that the criticisms from some people within the SNP have crossed the line into transphobia.
Former Out For Indy trans officer Teddy Hope told BBC Scotland earlier this month that they would be leaving the SNP because of its "inaction" over the behaviour of some party members at a branch meeting in Bearsden in March of last year.
Teddy, who identifies as non-binary, claimed that there were "transphobic views" voiced at the meeting, including comparisons to "predators and paedophiles".
In a video message posted on Twitter, Ms Sturgeon said she had heard reports of "mainly young people in significant numbers leaving the SNP" because they do not consider the party to be a safe, tolerant place for trans people.
The first minister said it "grieves her deeply" that they had reached that conclusion.
And she pledged to do "everything I can to change that impression and persuade all of you that the SNP is your party and that you should come home where you belong."
Ms Sturgeon added: "Trans people have as much right as any of us to be safe, secure and valued for who they are.
"Transphobia is wrong and we must treat it with the zero tolerance we treat racism or homophobia.
"Those are the principles I want to characterise the SNP and the country that I am privileged to lead."
Ms Sturgeon acknowledged that there were differences of opinion on gender recognition reform, but said the debate should not be used as "cover for transphobia".
What is the row about?
The Scottish government wants to amend the Gender Recognition Act to remove some of the existing barriers to people being able to change their legal gender.
It would see the country move to a "self-declaration model", with applicants no longer needing to have been diagnosed with gender dysphoria - distress as a result of a difference between their biological sex and their gender identity - or prove that they have been living as their acquired gender for two years.
The government has also been considering lowering the age that a person can apply to change their legally-recognised gender from 18 to 16.
But the proposals sparked a backlash, with 15 senior SNP politicians - including three cabinet ministers - writing an open letter urging Ms Sturgeon not to rush into the changes.
The group included Kate Forbes, who is now the country's finance secretary, and MP Joanna Cherry - who has been particularly outspoken about her concerns on social media.
In their letter, they said that changing the definition of male and female was a "matter of profound significance".
The letter stressed that all of those who had signed it were "committed to human rights, equality and dignity for all people" and called for an end to "knee-jerk accusations of transphobia" against anyone who raises concerns.
The government announced last year that it had "paused" work on the gender recognition proposals due to the coronavirus pandemic, and said it wanted to build "maximum consensus" on the issue in the future.
There has also been controversy within the Scottish Greens over trans rights, with MSP Andy Wightman quitting the party in December after accusing it of having an "alienating and provocative" stance on the issue.
Mr Wightman said he had been threatened with possible expulsion over his concerns about the potential impact on women's rights, and claimed that the party was "very censorious of any deviation from an agreed line".
The Greens had strongly backed the proposed changes to the Gender Recognition Act, with the party's co-leader, Patrick Harvie, claiming that transphobia has grown worse in Scotland because of Ms Sturgeon's failure to turn "words into actions".
And he said the Scottish government had broken promises to the trans community over gender recognition reforms.