(Adds background on allegations)
By Michael Holden
LONDON, Feb 25 (Reuters) - Britain's most senior Roman Catholic cleric resigned on Monday following allegations he behaved in an inappropriate way with priests, and said he would not take part in the election of Pope Benedict's replacement.
Cardinal Keith O'Brien said he had tendered his resignation some months ago, ahead of his 75th birthday in March and because he was suffering from "indifferent health".
The Vatican said the pope, who steps down on Thursday, had accepted O'Brien's resignation as archbishop of St. Andrews and Edinburgh.
O'Brien, an outspoken opponent of gay marriage, has been reported to the Vatican over allegations of inappropriate behaviour stretching back 30 years, according to Britain's Observer newspaper.
The cardinal, who last week advocated allowing Catholic priests to marry as many found it difficult to cope with celibacy, rejected the allegations and was seeking legal advice, his spokesman said.
"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," O'Brien said in a statement, which made no reference to the recent allegations.
He said he would not attend the election next month of a new pope, saying: "I do not wish media attention in Rome to be focussed on me - but rather on Pope Benedict XVI and on his successor."
The Observer, which gave little detail on the claims, said three priests and a former priest, from a Scottish diocese, had complained over incidents dating back to 1980.
One said the cardinal formed an "inappropriate relationship" with him while another complained of unwanted behaviour by O'Brien after a late-night drinking session.
Last year, O'Brien's comments labelling gay marriage a "grotesque subversion" landed him with a "Bigot of the Year" award from British gay rights group Stonewall. (Reporting by Guy Faulconbridge and Michael Holden; editing by Maria Golovnina and Jon Boyle)