The coalition between the Conservatives and the Liberal Democrats pits principle against pragmatism. It is fraught with possibilities and dangers; for the Lib Dems the key to success is to identify and fearlessly protect the bright red lines that must never be crossed. The landscape may have changed, but the geology hasn't.

I welcomed Labour's general election victory in 1997, but like many people judged the moment wrongly. I left the Labour Party on 15 August 2001. My resignation letter concentrated on three issues: the then government's failure to be bold and decisive on constitutional and structural reform; the cosying up to big money, as Labour became too intimately connected with the interests of large corporations; and the failure to distance itself from some of the policies of the Bush administration. That was four weeks before the 11 September 2001 attacks, before the full extent of the Bush/Blair alliance became apparent, before Labour became the party of illegal war and embroiled in allegations of complicity in torture.

After that, I started to work closely on issues of foreign policy and the rule of law, first with Menzies Campbell and then with Nick Clegg. They were leading the Liberal Democrats to do the right things on justice, human rights and international affairs, adopting principled positions that have been shown to be right, consistent with basic values of fairness and justice. They did not strike me as tribal, but sought instead to adopt serious, principled and progressive policies on immigration, on fair taxes, on education, on Trident, and on Britain's place in Europe and the world.

Sham rainbow

Eventually I joined the Liberal Democrats, and from a progressive perspective saw this general election as an important opportunity to reshape the political landscape. When my very good local Lib Dem candidate asked me to support him publicly, I was pleased to do so. The prospect of a hung parliament did not cause alarm - quite the opposite.

For many, the governing assumption was that this would lead to a Lib/Lab coalition, perhaps with a new Labour leader untainted by the worst excesses of the past 13 years. That did not happen. As the post-election negotiations unfolded, many assumed that the Lib Dem dance with the Tories was a case of "going through the motions", that the gaps would be far too great to bridge. When our discussions with Labour opened, we thought the Tories would be furious and the rifts would grow.

But the Tories weren't furious, at least not in public, whereas John Reid and David Blunkett were, dismally and loudly. From that moment it was clear that the numbers didn't stack up, because too many people in Labour didn't want them to stack up. A former Labour cabinet minister told me he had pretended to support a deal with the Lib Dems but didn't want one, and was relieved by the outcome. The rainbow coalition always was an illusion.

In reality, there were three possibilities once a hung parliament had been returned: a minority Tory government, a Tory government supported on some issues by the Lib Dems, or a fully fledged coalition between the two parties. The advantages and dangers of each were apparent. Under the first two options, it seemed likely that there would have been another election six months down the line. This would very likely have given the Tories a majority to act on their own, as happened with Labour in 1974.

Yet the coalition route risked destroying the Liberal Democrat vote in constituencies such as mine (Hampstead and Kilburn is a three-way marginal in which Tories, Lib Dems and Labour squeezed 50,000 votes more or less equally between them). Labour squeaked in by 42 votes.

The prospect of a Lib Dem-Tory coalition was not easy to accept; it poses great risks for the Lib Dems (as it does for the Tories, and also a Labour Party that could be consigned to a generation of irrelevance). Yet I wanted to see the details of the coalition agreement before forming a clearer view. I'm glad I did. It's a decent document, with much that is positive on civil rights, the environment and constitutional and structural reform, among other matters. David Cameron has made big concessions to enter No 10: the Lib Dems must hold him to them.

Unleash the findings

I worry greatly about the economics and about who will pay the price for the cuts in public spending that are coming. The test for Clegg and the Lib Dems is to ensure that those who can truly afford to pay for the economic clean-up are those who do pay, and that the most vulnerable are protected fully from the coming horrors. The fault lines are there for all to see, on Europe, Iran, nuclear power, immigration, even electoral reform. But are they that different from the lines that divide the Liberal Democrats from Labour?

The Lib Dems will learn that what was easy in opposition becomes much more complex in government. On Iraq and torture, they have been consistently right. Now, I want Clegg to unleash the Chilcot inquiry, so that it publishes the damning documents that Labour refused to release which show the truth about the road to war in Iraq. I want a full, judicial inquiry on allegations of British complicity in torture. I want a cast-iron commitment to permanent protections for human rights and freedom of information and equality for all.

I'm not starry-eyed about what may come, especially after the post-1997 betrayals. At home and among friends, I get grief about my contribution to "bringing in the Tories". Maybe I will be shown to have been wrong, but I want to look on the bright side and support the potential of this coalition agreement to deliver, provided the bright, red lines are respected.

Philippe Sands, QC, is professor of law at University College London and a barrister at Matrix Chambers