Some care home workers who test positive for coronavirus may have to continue working, according to new official guidance.
The guidance says infected staff should carry on with their work if not doing so would create an "unacceptable risk".
But this should only be for the "absolute minimum period" necessary - no longer than the end of their shift.
And it stresses that infected staff should only work with residents who are also known to have the virus.
Nearly half of all coronavirus deaths in Scotland have been in care homes, with eight staff and more than 1,400 residents having died so far.
The latest guidance from Health Protection Scotland was issued a week after draft guidance was published on the Scottish government website in error without being signed off by ministers.
It says that some homes may face "unavoidable delays" in replacing staff who test positive for Covid-19, which could "create an unacceptable risk to safety of the care being provided."
It adds: "If such a situation occurred, then any staff that had to continue working must only do so for the absolute minimum period (e.g. to complete a shift) pending their replacement."
The guidance states that infected staff should continue to wear the appropriate protective equipment, and should maintain "appropriate social distancing" when their mask has to be removed.
They should also eat and drink in a separate room - either alone or in the company of other infected staff.
And the guidance goes on to say that infected staff should "avoid unnecessary casual contacts and observe appropriate social distancing when heading home, avoiding if possible or limiting the use of public transport."
Speaking at her daily briefing, First Minister Nicola Sturgeon said the guidance should only be followed "in extremis" and for a "very short period of time", and urged care homes to develop contingency plans to avoid infected staff having to keep working.
She said: "This is about making sure that a care home is not left, even for a short period of time, without the right level of cover, because that would also pose a danger to residents in the care home.
"This is not about taking unacceptable risks with people who have the virus."
Ms Sturgeon also insisted that infected staff would not be providing direct clinical care to a resident - despite the guidance stating that they can "work with residents already known to be infected themselves."
'Isolate in a room'
Chief Nursing Officer Fiona McQueen said she hoped infected staff could be replaced on their shift in "minutes and hours", and that it would only apply to staff in a relatively small number of specific roles, such as a registered nurses.
She said: "If you are a registered nurse and you're in charge of that shift for 12 hours in a care home which may be 10 miles from anywhere and you have a text or telephone call saying that you are positive, then that nurse cannot just walk out of the care home.
"What I would expect them to do is go and isolate within a room until they have a relief coming to them."
The new guidance also sets out rules for admitting hospital patients to care homes during the pandemic, and policies around the testing of staff and residents.