Nicola Sturgeon has said comedian Janey Godley made a "dignified" apology over tweets which have been branded racist.
The first minister said the tweets by Ms Godley, who had fronted a public health campaign, were "completely out of order and unacceptable".
But she said Ms Godley had believed her status as a comedian gave her a licence to say what she had said.
Asked why the government did not spot the tweets before hiring Ms Godley, she responded: "These things happen."
And she said it was important that the row did not get in the way of public health messaging around Covid.
Ms Godley, a prominent independence supporter, has admitted the tweets - which were sent between 2011 and 2017 - had "terrible, horrific undertones" after they were published by the Daily Beast website and several newspapers.
Several were about black performers including Kelly Rowland, 50 Cent and Snoop Dogg.
The comedian gained a large online following for her viral voice-overs of Ms Sturgeon's daily briefings during the lockdowns.
She had been paid £12,000 by the Scottish government to front its #stopthespike campaign to encourage face coverings and lateral flow testing.
Ms Godley has previously appeared in government-funded Zero Waste Scotland promotions.
The government announced on Thursday it was dropping the adverts, with Ms Godley saying she would donate her fee to the STV Children's Appeal.
Ms Godley has also pulled out of her role in the Beauty and the Beast pantomime at His Majesty's Theatre in Aberdeen this winter.
A statement from Aberdeen Performing Arts, which is putting on the production, said: "We do not condone any form of discrimination, nor do we condone online bullying, trolling or abuse.
"We recognise that the only appropriate course of action in these circumstances was for her to step down."
Speaking to the BBC's Good Morning Scotland programme, Ms Sturgeon was asked whether she was angry her government had not done its due diligence on Ms Godley before hiring her to front the campaign.
She replied: "Look, these things happen. The important thing is that action is taken.
"The most important thing to me from the start of this pandemic has been the integrity of our public health message.
"Janey has apologised and she has been pretty straightforward and dignified in her apology.
"She is a comedian and as she said herself she thought that gave her licence to say things that she accepts were completely out of order and unacceptable."
Critics of the government have accused it of double standards over its response to Ms Godley's tweets, questioning whether it would have been more critical of her if she was not an independence supporter.
Ms Sturgeon said this would have been a legitimate question if the government had not decided to drop Ms Godley's advertising campaign, which ran on TV and social media.
She added: "I get a lot of abuse on social media and I know that when people make mistakes the climate that we live in, the culture we live in these days, is pretty unforgiving.
"Therefore I'm a great believer that when people make mistakes - and I apply this to myself as well - it is really important to hold your hands up to that and apologise where that is required."
But she stressed that the tweets she had seen from Ms Godley were "completely unacceptable, completely beyond the pale and I would not in any way, shape or form seek to defend them".
Who is Janey Godley?
Ms Godley was brought up in the east end of Glasgow, and has spoken candidly of her traumatic early life which included poverty and sexual abuse, before beginning a comedy career later in life.
She has appeared on the BBC as panellist on shows such as BBC Radio Scotland's Breaking the News and BBC One's Have I Got News for You, and as an actor in Traces.
She has also performed with The National Theatre of Scotland and was a regular at the Edinburgh Fringe.
High-profile comedians, including David Baddiel and Dawn French, offered their support on Twitter on Wednesday. Aberdeen Performing Arts had said they stood by their decision to cast her in their pantomime Beauty and the Beast this winter. However, they announced on Friday afternoon that Ms Godley had withdrawn from the show.
Ms Godley said in a statement that there were tweets from her past social media which were "horridly offensive".
She added: "People have every right to go through my social media and see what values I hold and to find hurtful phrases and statements is shocking.
"I am deeply sorry to everyone I offended.
"Comedy is no excuse to use disgusting and hurtful words that affect people and I know many of you expected better of me. I apologise for every single word that upset people."
Scottish Conservative MSP Russell Findlay said: "It's jaw-dropping to hear a first minister of Scotland dismiss racist tweets so casually.
"You would expect Nicola Sturgeon to be appalled by this kind of language but when asked about it, her flippant response was: 'These things happen'.
"It's starting to look like nationalist and SNP supporters get special treatment from this government. This contract should never have been awarded in the first place and the first minister should be a lot more contrite now that these shameful tweets have emerged."