The 74-year-old tendered his resignation as Archbishop of St Andrews and Edinburgh in November to Pope Benedict XVI, but said in a statement today: "The Holy Father has now decided that my resignation will take effect today."
He added that he would not be attending the conclave of cardinals due to choose a successor to Pope Benedict next month in Rome, leaving Britain's Roman Catholics with no vote in the election.
"I have valued the opportunity of serving the people of Scotland and overseas in various ways since becoming a priest," Cardinal O'Brien said in a statement.
"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."
The announcement of his immediate resignation comes after the Observer newspaper reported that three priests and a former priest in Scotland reported the cardinal to the Vatican over allegations of inappropriate behaviour stretching back 30 years.
It is understood that Cardinal O'Brien contests the claims.
The Observer said the four statements containing the claims were submitted to the Papal Nuncio Antonio Mennini's office the week before Benedict's resignation was announced on February 11.
The former leader of Scotland's Roman Catholics, Cardinal O'Brien tendered his resignation in November to the Pope citing "indifferent health" but had not been expected to step down until his 75th birthday on March 17.
He was created a cardinal by Pope John Paul II in 2003 and became prominent for his colourful and strongly- voiced defence of conservative Catholic teaching.
His opposition to gay marriage earned him the Bigot of the Year award from the gay rights group Stonewall and in 2007 he caused controversy when, speaking on the 40th anniversary of the Abortion Act, he said the termination rate north of the border was equivalent to "two Dunblane massacres a day".
But on Friday, in an interview with the BBC, the cardinal surprised commentators by backing an end to the celibacy rule for the priesthood.
In his statement, Cardinal O'Brien, who played a key role in welcoming Pope Benedict on his visit to Scotland and England in 2010, thanked the pope for his "kindness and courtesy" towards him and the people of Scotland.
"I thank Pope Benedict XVI for his kindness and courtesy to me and on my own behalf and on behalf of the people of Scotland, I wish him a long and happy retirement," he said.
"I also ask God's blessing on my brother cardinals who will soon gather in Rome to elect his successor. I will not join them for this conclave in person."
He added that he would not be taking part in the upcoming conclave as he did not wish to be the centre of media attention.
"I do not wish media attention in Rome to be focussed 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.
"May God who has blessed me so often in my ministry continue to bless and help me in the years which remain for me on earth and may he shower his blessings on all the peoples of Scotland especially those I was privileged to serve in a special way in the Archdiocese of Saint Andrews and Edinburgh."
Cardinal O'Brien did not attend mass at St Mary's Cathedral in Edinburgh yesterday following the allegations in the Observer.
He was due to celebrate eight years of Pope Benedict holding office.
The cardinal, who was born in Ballycastle, Co Antrim, has been the Archbishop of St Andrews and Edinburgh since 1985.
Scotland's First Minister Alex Salmond said: "I hear the news of Cardinal O'Brien's resignation with the greatest sadness.
"In all of my dealings with the cardinal, he has been a considerate and thoughtful leader of the Catholic Church in Scotland, stalwart in his faith but constructive in his approach.
"The hugely successful visit of Pope Benedict in 2010 was a highlight of his cardinalship and symbolised the key role of the Catholic Church in Scottish society.
"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."
An apostolic administrator will be appointed to govern the Archdiocese of Saint Andrews and Edinburgh until a successor to Cardinal O'Brien is appointed.
The Rev Sharon Ferguson, chief executive of the Lesbian and Gay Christian Movement, said Cardinal O'Brien's resignation was a "positive thing".
"He has been a very vocal opponent of lesbian and gay equality and we can only pray that whoever takes over his position will be a little bit more thoughtful in the way they choose to conduct themselves towards lesbian and gay people and lesbian and gay Catholics in particular," he said.
"He has hurt a lot of people and excluded a lot of people from God's love with what he has done."
Jack Valero, of the group Catholic Voices, said: "It was very surprising to hear of these allegations and also very sad but given what has been alleged, I think it was the right decision to resign and not cast a shadow over the conclave, so that the pope can be elected without this distraction and the allegations can be investigated properly over the next few weeks.
"I think it is good that it has been dealt with so quickly, and we must get to the truth, but not let that distract from the big process that is going on in the church."
He said no British cardinal would have a vote in the papal conclave but Cardinal Cormac Murphy-O'Connor, the retired Archbishop of Westminster, who at 80 years old no longer qualifies to vote, would be taking part in pre-meetings when all the cardinals regardless of voting rights discuss the suitability of candidates for the papacy.
Cardinal Keith O'Brien's resignation and his decision not to attend the papal conclave leaves Britain's Roman Catholics without a vote in the forthcoming election to choose the successor to Pope Benedict XVI.
The announcement comes after allegations by three priests and one ex-priest of inappropriate behaviour, published in yesterday's Observer newspaper and dating back to the 1980s. The cardinal reportedly contests the claims.
Cardinal O'Brien is no stranger to making the news but it is more usually the result of his at times outspoken views.
He has been an advocate of priests marrying but also an outspoken opponent of plans to legalise same-sex marriage.
Last year his stance earned him the Bigot of the Year award from the gay rights group Stonewall.
In 2007 he caused controversy when, speaking on the 40th anniversary of the Abortion Act, he said the termination rate north of the border was equivalent to "two Dunblane massacres a day".
In 2008 he described the implications of the Human Fertilisation and Embryology Bill as "grotesque" and akin to "Nazi-style experiments".
The 74-year-old, who is Archbishop of Saint Andrews and Edinburgh, was created and proclaimed a cardinal by Pope John Paul II in October 2003.
The cleric was born in Ballycastle, County Antrim, Northern Ireland.
He obtained a bachelor of science degree in chemistry and mathematics from the University of Edinburgh and a diploma in education.
On April 3 1965 he was ordained a priest.
Cardinal O'Brien served as assistant parish priest and as chaplain of St Columba Secondary School in Cowdenbeath, where he taught maths.
He was spiritual director of St Andrew's College in Drygrange and rector of St Mary's College, Blairs.
On August 5 1985 he was ordained Archbishop of St Andrews and Edinburgh.
Six years later he was awarded the Equestrian Order of the Holy Sepulchre of Jerusalem: Knight Commander with star.
From 1996 to 1999 he served as Apostolic Administrator of the Diocese of Argyll and The Isles and from March 2002 until 2012, Cardinal O'Brien was President of the Bishops' Conference of Scotland.
The cardinal had a pacemaker fitted in 2008 following heart problems and dizzy spells.
This could be a pivotal moment for RC church