Britain's most senior Roman Catholic cleric, Cardinal Keith O'Brien, is stepping down as leader of the Scottish Catholic Church.
He had been accused of inappropriate behaviour towards priests dating back to the 1980s - claims he contests.
Cardinal O'Brien, the Archbishop of St Andrews and Edinburgh, apologised to "all whom I have offended" for "any failures" during his ministry.
He will not take part in electing a new pope, leaving Britain unrepresented.
The cardinal said in a statement: "I have valued the opportunity of serving the people of Scotland and overseas in various ways since becoming a priest.
"Looking back over my years of ministry: For any good I have been able to do, I thank God. For any failures, I apologise to all whom I have offended."
He remains a cardinal and would be entitled to join the conclave selecting the new Pope after Benedict XVI announced on 11 February that he would resign - but said he would not go.
"I do not wish media attention in Rome to be focused on me - but rather on Pope Benedict XVI and on his successor," he said.
"However, I will pray with them and for them that, enlightened by the Holy Spirit, they will make the correct choice for the future good of the Church."
The Vatican confirmed the cardinal has stepped down from his post.
Although the announcement has only just been made public, the Scottish Catholic Media Office said Pope Benedict had accepted the cardinal's resignation on 18 February.
The allegations against Cardinal O'Brien emerged in a report in the Observer newspaper on Sunday.
It said three priests and one former priest, from the diocese of St Andrews and Edinburgh, complained to the Pope's representative to Britain, nuncio Antonio Mennini, in the week before 11 February.
- The former priest claims Cardinal O'Brien made an inappropriate approach to him in 1980, after night prayers, when he was a seminarian at St Andrew's College, Drygrange. The complainant says he resigned as a priest when Cardinal O'Brien was first made a bishop
- A second statement from another complainant says he was living in a parish when he was visited by O'Brien, and inappropriate contact took place between them
- A third complainant alleges dealing with what he describes as "unwanted behaviour" by the cardinal in the 1980s after some late-night drinking
- And the fourth complainant claims the cardinal used night prayers as an excuse for inappropriate contact
A Scottish Catholic Media Office spokesman said a number of bishops' appointments and resignations were being accepted in the last days of the Pope's time in office.
He said Cardinal O'Brien was taking legal advice and contested the allegations against him, which were "anonymous and non specific".
In Rome, the BBC's world affairs correspondent James Robbins said for a long time the Vatican had been able to "bat away" some criticism of other cardinals who may have been involved in covering up allegations of sexual abuse.
But these were more serious because they alleged Cardinal O'Brien was involved directly in improper behaviour towards other priests.
He added that there was also a sense of regret that Britain would have no voice in the conclave to choose Pope Benedict's successor.
Cardinal O'Brien has been known as a outspoken defender of Catholic teaching on abortion, euthanasia and homosexuality.
He was named Bigot of the Year last year by gay rights group Stonewall Scotland, after he said gay marriage was a "grotesque subversion of a universally accepted human right".
Catherine Deveney, who wrote the Observer piece, said the story was important because the cardinal had set a "moral blueprint" for the way other people should lead their lives.
She said the complainants were "men of integrity" who had "done a difficult thing and acted according to their conscience".
Scotland's First Minister Alex Salmond said: "It would be a great pity if a lifetime of positive work was lost from comment in the circumstances of his resignation.
"None of us know the outcome of the investigation into the claims made against him but I have found him to be a good man for his church and country."
Jack Valero, from Catholic Voices, a media lobby group that represents many Catholics in Britain, said it was the right move for the cardinal to resign.
"I am very happy that they have been taken seriously, that the nuncio - the Pope's representative in the UK - has written to the four people who have made the allegations to thank them for speaking out, and that the whole thing has been done so quickly. I think this shows a new spirit."
Colin MacFarlane, director of Stonewall Scotland, said he hoped there would be a full investigation.
And that the cardinal's successor should "show a little more Christian charity towards openly gay people than the cardinal did himself".
But Clifford Longley, a religious commentator and columnist for the Catholic newspaper The Tablet, said the cardinal's resignation was "the worst thing that could possibly have happened to the Church at this moment - to have another row like this when there already so many going on."
Cardinal O'Brien was due to retire when he turned 75 next month. His resignation statement said the Pope would appoint someone to govern the archdiocese in his place, until his successor was appointed.