One of Nicola Sturgeon's ministers has resigned over her opposition to a controversial transgender law just hours before it was due to go to a vote.
Community safety minister Ash Regan said her "conscience" would not allow her to vote with the Scottish government by backing the Gender Recognition Reform (Scotland) Bill at its first stage on Thursday evening.
The bill, supported by Ms Sturgeon, will remove the requirement for a medical diagnosis of gender dysphoria when seeking a gender recognition certificate, so people can change their legal sex simply by signing a declaration.
It will also reduce the length of time an applicant must live as their acquired gender from two years to three months, with an additional three-month reflection period.
The bill aims to lower the age someone can apply for a gender recognition certificate from 18 to 16.
The Gender Recognition Reform (Scotland) Bill was later approved by MSPs at stage one by 88 votes to 33, with four abstentions.
In a letter to first minister Ms Sturgeon, Ms Regan, MSP for Edinburgh Eastern, wrote: "I have considered the issue of gender recognition reform very carefully over some time.
"I have concluded that my conscience will not allow me to vote with the government at stage one of the bill this afternoon.
"Consequently, I am writing to resign my position in the Scottish government as minister for community safety."
Some women's groups have raised concerns women and girls' rights could be put at risk by the law.
Harry Potter author JK Rowling, who lives in Scotland, has accused Ms Sturgeon of "riding roughshod" over women's rights with the bill and said the first minister will be held personally responsible if the law leads to attacks on girls.
She said Ms Sturgeon would be to blame for cases of "voyeurism, sexual harassment, assault or rape" she believes could come from allowing Scots to change their sex so easily.
Rowling, who earlier this month wore a T-shirt saying Ms Sturgeon is a "destroyer of women's rights", said the first minister's insistence it was transphobic to claim predatory men could claim to identify as female to gain access to women's spaces was "extraordinary".
Ms Sturgeon accepted her minister's resignation on Thursday, but replied by saying "at no stage have you approached me to raise your concerns" about the bill or Thursday's vote.
"However, in circumstances in which a minister is unable to support the government, it is the case that the only options available are resignation ahead of the vote or dismissal thereafter," she added.
SNP members are understood to have been whipped to vote in favour of the bill, while Scottish Labour, the Liberal Democrats and the Greens were also expected to back it.
The Scottish Conservatives were given a free vote, with most expected to oppose the change.