Boris Johnson's adviser on the ministerial code has resigned after the PM backed Home Secretary Priti Patel over a bullying inquiry.
Standards chief Sir Alex Allan found that Ms Patel had broken the code governing ministers' behaviour.
But the PM rejected his findings, saying he did not think Ms Patel was a bully and had "full confidence" in her.
She gave a "fulsome apology" but said she was not "supported" - at the time claims were made - by her department.
She also said "issues were not pointed out to" her and insisted that "any upset I have caused was completely unintentional".
But she admitted "there are no excuses" for her conduct, adding: "I've clearly upset people."
Ministers are normally expected to resign if they break the code.
But although Sir Alex - who was asked by the PM to investigate the allegations - found the code had been broken, Mr Johnson took a different view and he has the final say.
The prime minister's spokeswoman insisted Mr Johnson took bullying "very seriously" but "does not believe that Priti Patel is a bully", pointing to "mitigating circumstances" in Sir Alex's report and Ms Patel's "full and frank apology".
Sir Alex announced his resignation as the prime minister released his statement on the report's findings.
"I recognise that it is for the prime minister to make a judgement on whether actions by a minister amount to a breach of the ministerial code," he said.
"But I feel that it is right that I should now resign from my position as the prime minister's independent adviser on the code."
Sir Alex Allan's report examined Ms Patel's behaviour at three different government departments - the Home Office, Work and Pensions and International Development.
In his findings, Sir Alex said Ms Patel "has not consistently met the high standards required by the ministerial code of treating her civil servants with consideration and respect" and cited examples of "shouting and swearing".
He added: "Her approach on occasions has amounted to behaviour that can be described as bullying in terms of the impact felt by individuals.
"To that extent her behaviour has been in breach of the ministerial code, even if unintentionally."
However, he added that the home secretary had "legitimately - not always felt supported by the department".
"In addition, no feedback was given to the home secretary of the impact of her behaviour, which meant she was unaware of issues that she could otherwise have addressed."
Speaking to the BBC, Ms Patel said: "I am sorry if I have upset people in any way whatsoever - that was completely unintentional."
She said the work in her department is "deeply challenging" and at the time of the allegations, "issues were not pointed out to me, we were not being supported in our work."
She added she was working with the Home Office Permanent Secretary, Matthew Rycroft in "a more collective, collaborative way" to change the culture within the department.
The inquiry was launched by Boris Johnson in March, following the resignation of top civil servant at the Home Office Sir Philip Rutnam. Sir Philip - who is suing the government for constructive dismissal - alleged staff felt Ms Patel had "created fear".
But Sir Philip Rutnam has told the BBC he was never asked to contribute to the investigation - and he insists Ms Patel was "advised" on a number of occasions about the need to treat staff with respect.
The report says there was "no evidence that she (Priti Patel) was aware of the impact of her behaviour, and no feedback was given to her at the time".
Issuing a statement exclusively to the BBC, he says: "As early as August 2019, the month after her appointment, she was advised that she must not shout and swear at staff.
"I advised her on a number of further occasions between September 2019 and February 2020 about the need to treat staff with respect."
What is the ministerial code?
- Government document setting out "expected standards" of behaviour in office, which include "consideration and respect" for civil servants and other colleagues
- In the foreword, Boris Johnson says: "There must be no bullying and no harassment."
- Ministers are normally expected to resign if they are found to have broken the code
- Ministers who have stepped down include Liam Fox, over taking a friend and lobbyist on official trips, and Mark Field, who grabbed a climate protester
- The code has existed since the Second World War but was not made public until 1992
Labour leader Sir Keir Starmer said: "Yet again, the prime minister has been found wanting when his leadership has been tested.
"If I were prime minister, the home secretary would have been removed from her job."
Liberal Democrat leader Sir Ed Davey suggested the PM's failure to sack Ms Patel indicated there was "one rule for him and his friends and another rule for everyone else".
That a prime minister can overrule the findings of an independent inquiry into one of his own closest colleagues may sit uncomfortably with many.
It clearly did with Sir Alex Allan.
As a political risk within Westminster though, it's probably not a particularly high stakes move by Boris Johnson.
Priti Patel has a lot of support within the Conservative party, particularly among grassroots members, so he's unlikely to face too much trouble on the party management front.
That's not something you've been able to say too often in recent times.
Where it is likely to cause a bit of a backlash is in Downing Street's relations with the civil service, which have already been under strain.
So far this administration hasn't been too bothered about whether or not it upsets Whitehall although there had been talk that Boris Johnson's post-Dominic Cummings "reset" might include mending a few fences there.
The bigger unknown - and possibly the bigger risk - is what voters will make of it.
The head of the civil servants' union FDA Dave Penman said: "What is the point of the investigation if actually what we're saying is it doesn't matter what evidence has been found, it doesn't matter what the PM's own adviser on the ministerial code says, if it's politically convenient for the PM to ignore it, he will ignore it."
But Tory MPs have rallied behind Ms Patel, former minister Simon Clarke telling the BBC she had been working "under the most challenging circumstances to bring about major change in a department that needs it".
"Things are now improving, crucially," he told Radio 4's World at One.
The head of the Committee on Standards in Public Life, Lord Evans, said there were "serious questions" about the process for investigating breaches of the ministerial code which must be "urgently" looked into.