Anas Sarwar has vowed to ban transgender women from the female prisons "within days" if he becomes first minister after the Holyrood election.
The Scottish Labour leader has pledged that his party will "act swiftly" to ensure prisons are "single-sex, based on biological sex" if it gets into power in May.
His declaration comes ahead of a Court of Session hearing this week between For Women Scotland (FWS) and the Scottish government over the management of transgender prisoners.
FWS is taking action at Scotland's highest civil court, claiming the current guidelines are "unlawful" in light of last year's landmark Supreme Court judgment over the definition of a woman.
Mr Sarwar said: "The Supreme Court is clear; the Equality Act must be respected.
"That means defending single-sex spaces for biological women in services, in sport and in everyday life. That is what I will deliver in government.
"But nowhere does this matter more than in our prison system. Women's prisons exist for a reason - to keep women safe.
"Many women in custody have experienced trauma and violence, often at the hands of men.
"It is simply not right that men who have committed sexual or violent crimes against women can be housed in women's prisons. That undermines safety, dignity and trust.
"A Scottish Labour government would act swiftly. Within days, we would ensure prisons are single-sex, based on biological sex, and bring an end to years of confusion and costly legal disputes paid for by the taxpayer."
Current Scottish Prison Service (SPS) guidance allows for a transgender woman to be admitted into the female prison estate if the inmate does not meet the violence against women and girls criteria, and there is no other basis "to suppose" they could pose an "unacceptable risk of harm" to those also housed there.
The policy was reviewed in 2024 after convicted transgender rapist Isla Bryson was initially housed in a women-only prison before being swiftly moved to the male estate following a public outcry in 2023.
In recent months, the Scottish government has repeatedly dodged questions over the FWS case - which is due to take place between 3 and 5 February.
However, in legal arguments published ahead of the three-day hearing, the government said a "blanket rule" about placing transgender prisoners in jails according to their biological sex "would violate the rights of some prisoners".
The government plan to argue that placing inmates in a prison for those of the opposite biological sex "may be required" to prevent a violation of the Human Rights Act and Scotland Act 1998.
Decisions on the placement of transgender prisoners are based on an "individualised assessment" in accordance with the prisons guidance, the government said, and there has reportedly been no "significant operational issue" as a result of transgender inmates being housed in jails for the opposite sex.
Read more from Sky News:
'Suffolk strangler' pleads guilty to murder of teen in 1999
Stabbed teenager dies from injuries
In response to Mr Sarwar's pledge, the Scottish Conservatives accused him of having "some brass neck".
Rachael Hamilton, the party's deputy leader, added: "He whipped his own MSPs to back Nicola Sturgeon's reckless gender self-ID proposals, and even forced two of his frontbench team to quit for refusing to do so.
"He arrogantly refused to listen to women and girls from within his own party at the time, and gave the green light to plans that would have put dangerous male criminals into women's prisons.
"It was only thanks to the UK Conservative government that these dangerous plans did not end becoming a reality.
"Scots will not be fooled by his pledge, and will remember Scottish Labour being on the wrong side of history and siding with Nicola Sturgeon when it really mattered."
(c) Sky News 2026: Scottish Labour commits to banning transgender women from female prisons if Ana
'Suffolk strangler' Steve Wright pleads guilty to murder of teen in 1999
Emma Caldwell: Family of woman murdered by serial rapist say there must be 'no attempt' to shut down evidence at public inquiry
Sea captain found guilty of killing crew member in North Sea collision with US oil tanker
Man, 25, charged with murder after death of woman in northwest London