Scotland’s chief medical officer has apologised for visiting her family’s second home in Fife during the coronavirus pandemic, against her own advice that all Scots should stay home.

Dr Catherine Calderwood said her reasons for visiting the house were “not legitimate” and she is “truly sorry for not following advice she gave to others”.

Despite facing calls from politicians to stand down, she said she has spoken to First Minister Nicola Sturgeon and will “continue to focus entirely” on her job of advising ministers over the outbreak.

Photos of Dr Calderwood and her family near a coastal retreat in Earlsferry were published in The Scottish Sun late on Saturday.

Just days earlier, the 51-year-old tweeted a photo of her family at their main residence in Edinburgh as they clapped for the frontline NHS staff working to stop the spread of Covid-19.

Earlsferry is a drive of more than an hour from Edinburgh.

In a statement, Dr Calderwood said: “I wish to apologise unreservedly for the issue reported in the media today.

“While there are reasons for what I did, they do not justify it and they were not legitimate reasons to be out of my home.

“While I and my family followed the guidance on social distancing at all times, I understand that I did not follow the advice I am giving to others, and I am truly sorry for that.

“I know how important this advice is and I do not want my mistake to distract from that.

“I have a job to do as chief medical officer to provide advice to ministers on the path of this virus and to support the medical profession as they work night and day to save lives, and having spoken with the First Minister this morning I will continue to focus entirely on that job.”

Scotland’s Constitution Secretary Mike Russell said there was no doubt Dr Calderwood’s visit – which the Scottish Government confirmed was an overnight stay to “check on a family home” – was “ill-advised”.

He said she would be “answerable” for her decision when she appears at the daily coronavirus briefing with Nicola Sturgeon later.

He added: “I’m saying to everybody… do not go out except in the very exceptional circumstances that are listed, think about these things and remember by breaking them you are risking lives.”

Scottish Police Federation general secretary Calum Steele said policing the pandemic had been made more difficult and stressed checking on a second home is not one of the “reasonable excuses” providing an exception to emergency coronavirus legislation.

He tweeted: “In defending the indefensible has the Scottish Government not just thrown the CMO under the bus? Checking on a 2nd home is not one of the prescribed reasonable excuses.”

In a joint statement, Scottish Liberal Democrat leader Willie Rennie and Wendy Chamberlain, the MSP and MP respectively for the area where Dr Calderwood has her second home, said: “It is difficult to see how the chief medical officer will be able to carry the important messages about the virus and the lockdown if she has not even followed it herself.”

They added: “If we are going to get through this pandemic we need medical leaders who everyone can follow. It is with great regret that we say that the chief medical officer will need to go.”

Scottish Labour’s health spokeswoman Monica Lennon also called for Dr Calderwood to stand down, while Scottish Conservative leader Jackson Carlaw said her position is “untenable” and the Scottish Greens said she can “no longer credibly front” the public health campaign.

Earlier, Scotland’s national clinical director Jason Leitch said his colleague would not have put people in the area of her holiday home at risk.

Speaking on BBC Breakfast, he said: “My understanding is that she has worked like the rest of us 24/7 on this for weeks now and that family do have a home a little bit away from Edinburgh and they went to check on it.

“They observed social distancing throughout, so they were very safe. Nobody knows those guidelines better than Catherine and the rest of us.

“So I’m confident that she was safe during that, her family were safe and those around them were safe.”

Last month, the Scottish Government issued a travel warning criticising the “irresponsible behaviour” of people with second homes and campervans travelling to the Highlands in a bid to isolate.