Cardinal Keith O'Brien has admitted that his sexual conduct has at times "fallen beneath the standards expected of me".

In a statement, he apologised and asked forgiveness from those he had "offended".

He also apologised to the Catholic Church, and to the people of Scotland.

The cardinal resigned last Monday after three priests and a former priest made allegations of improper behaviour against him.

Cardinal O'Brien had been Britain's most senior Roman Catholic cleric when he stood down as the Archbishop of St Andrews and Edinburgh.

At the time, he said he would not take part in the election for a successor to Pope Benedict.

The statement issued through the Roman Catholic Church in Scotland read: "In recent days certain allegations which have been made against me have become public. Initially, their anonymous and non-specific nature led me to contest them.

"However, I wish to take this opportunity to admit that there have been times that my sexual conduct has fallen below the standards expected of me as a priest, archbishop and cardinal.

"To those I have offended, I apologise and ask forgiveness. To the Catholic Church and people of Scotland, I also apologise.

"I will now spend the rest of my life in retirement. I will play no further part in the public life of the Catholic Church in Scotland."

The cardinal - who initially said he was taking legal advice when the allegations against him were made public - had been due to retire later this month when he turned 75.

The former priest and three current priests from the diocese of St Andrews and Edinburgh complained to the Pope's representative to Britain, Archbishop Antonio Mennini, in early February about what they alleged had been inappropriate behaviour towards them in the 1980s.

The ex-priest told the Observer he was disappointed by the "cold disapproval" he faced for "daring to break ranks".

He also claimed to have only gone public because he feared the matter was in danger of being swept under the carpet by the church.

Last week, the Observer reported that the former priest had claimed 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.

Inappropriate contact

A second statement from another complainant said he had been living in a parish when he was visited by Cardinal O'Bren, and inappropriate contact had taken place between them.

A third complainant alleged he faced what he described as "unwanted behaviour" by the cardinal in the 1980s after some late-night drinking.

The fourth complainant claimed the cardinal used night prayers as an excuse for inappropriate contact, the newspaper said.

Cardinal O'Brien, who was born in Ballycastle, Co Antrim, had been the Archbishop of St Andrews and Edinburgh since 1985.

He has been an outspoken opponent of plans to legalise same-sex marriage in Scotland and was named "bigot of the year" by gay rights charity Stonewall last year.

In an interview with BBC Scotland shortly before the allegations against him were made public, the cardinal said he believed priests should be able to marry and have children if they wished.

He said it was clear many priests struggled to cope with celibacy.

***Analysis - David Willey (BBC News, Rome)

The public admission of sexual misconduct by Britain's most senior Roman Catholic cleric, Cardinal Keith O'Brien, former head of the Church in Scotland, could not have come at a more embarrassing moment for the Vatican.

In a few hours time, his fellow Cardinals from around the world gather in Rome for preliminary discussions on the choice of a successor to Pope Benedict, who resigned last month.

Cardinal O'Brien had his resignation as Archbishop of Saint Andrews and Edinburgh accepted last week by the former Pope - now known as Pope Emeritus.

He made it clear he would not be attending the conclave although it is normally a duty of all cardinals under the age of 80 to take part in the election process - known as a Conclave.

The Rome gathering is already overshadowed by allegations of scandal, intrigue and betrayal among the Vatican hierarchy.

The credibility of the Roman Catholic Church will be further damaged by Cardinal O'Brien's confession of inappropriate sexual behaviour