Mr Mandela died at home at the age of 95, after several months of ill health.

In the Commons, Mr Cameron said: "Nelson Mandela was a towering figure in our lifetime - a pivotal figure in the history of South Africa and the world - and it is right that we meet in this Parliament to pay tribute to his character, his achievements and his legacy."

He added: "When looking back over history it can be easy to see victories over prejudice and hatred as somehow inevitable.

"As the years lengthen and events recede, it can seem as though the natural tide of progress continually bears humanity ever upwards, away from brutality and darkness and towards something better. But it is not so.

"Progress is not just handed down as a gift; it is won through struggle - the struggle of men and women who believe things can be better, who refuse to accept the world as it is but dream of what it can be. Nelson Mandela was the embodiment of that struggle.

"He did not see himself as the helpless victim of history; he wrote it."

Gordon Brown paid tribute to Nelson Mandela's courage

Mr Miliband said MPs were celebrating "the spirit of what Nelson Mandela taught us to acknowledge", to accept "the truth about the past, and without rancour to welcome the change that has come to pass".

He added: "He is an enduring and unique symbol of courage, hope and the fight against injustice.

"He teaches us the power of forgiveness, showing no bitterness towards his captors, just the love of a country that could be so much better if all of its people could be free."

Mr Clegg said: "Given the enormity of his achievements, we're all struggling to work out the best way to honour his legacy. I like to think that one of the things he would like us to do in this House today is to pay tribute to and support the individuals and the organisations around the world that fight for human rights and do not have a global name."

As tributes continued, former Prime Minister Gordon Brown said Mr Mandela had been "the greatest man of his generation" and "across the generations, one of the most courageous people you could ever hope to meet".

Former Conservative Foreign Secretary Sir Malcolm Rifkind said Mr Mandela had not been a "saint" but a "politician to his fingertips" who had moved on from believing in "armed struggle".

There were cries from the Labour benches when Sir Malcolm suggested it had possibly been "more difficult" for Mr Mandela's predecessor as president, the white National Party leader FW de Klerk, to move away from apartheid to democracy. He said South Africa had "two heroes" in these politicians.

Former Labour cabinet minister Peter Hain accused some political figures, including former Conservative Party chairman Lord Tebbit, of "complicity" with the apartheid system.

He added that Mr Mandela retained an "extraordinary humanity".

A book of condolence has been set up in the Commons library for MPs, peers and staff to sign.

In an hour of tributes in the House of Lords, Labour's Lord Joffe, who was born in South Africa and acted as Mr Mandela's lawyer at his trial, praised his "indomitable courage".

"He always valued the support of the British people in the fight against apartheid," the peer added.

Meanwhile, it has been confirmed that former Prime Ministers Sir John Major, Tony Blair and Gordon Brown will join Mr Cameron at Tuesday's memorial service for Mr Mandela in Johannesburg.

Speaker John Bercow said it was a "day for special tributes to a special statesman"

Some 60 heads of state and government have said they will attend the event or Sunday's state funeral.

Mr Cameron, Mr Miliband and Mr Clegg will represent the UK and join other world leaders at the service on Tuesday at the Soweto stadium in Johannesburg.

This was the venue for the closing ceremony of the World Cup in 2010 - Mr Mandela's last public appearance.

The Prince of Wales is to represent the Queen at Mr Mandela's funeral on 15 December in the rural location of Qunu - the ex-president's childhood village.

The monarch is, however, expected to attend a national service of thanksgiving for the life of Mr Mandela at Westminster Abbey, which will take place in the new year.

Tributes and flowers have continued to be laid at Mr Mandela's statue in Parliament Square. He visited the UK for its unveiling in 2007 by the then Prime Minister Gordon Brown.

A civic event will take place later in the week at Westminster Hall, where Mr Mandela addressed both houses in 1996.