By Sunil Raman
BBC News, Delhi
Three BJP MPs alleged they had been offered bribes, sparking uproar
It took more than an hour after members pressed the buttons on the electronic voting machines for the results to be tallied.
The normally reticent Prime Minister Manmohan Singh beamed and loudly thumped the wooden desk as Speaker Somnath Chatterjee read the results that gave his ruling coalition a 19-vote victory in a confidence vote necessitated by the withdrawal of support by its communist allies.
Congress president Sonia Gandhi's son, Rahul, was on his feet along with some other young MPs from the party and loudly cheered.
Congress members hugged and shook hands with their colleagues, while others chanted in support of the government.
The party's MPs looked liberated. Four years of wrangling between Congress and the communist parties had ended. And they were finally not carrying the burden of being supported by the communists.
The main opposition Hindu nationalist BJP looked stunned. Silence descended on the opposition benches.
BJP leader LK Advani, projected by his party as a prime ministerial candidate, looked crestfallen.
Not only had the attempt to unseat the Congress-led government failed but about half a dozen BJP members had either voted for the government or absented themselves.
Communist members were equally stunned. They had gone all-out after the Congress party and even accused the prime minister of being US President George W Bush's ally.
Communist Party of India leader D Raja looked heartbroken. For a change, television crews were not chasing him and his comrades for a sound-bite.
"The government should not go ahead with the nuclear deal. The vote was close," said Mr Raja.
Reporters were instead chasing the new ally of the Congress party.
Samajwadi Party leader Mulayam Singh Yadav, who has 34 MPs, walked out of Parliament House triumphantly.
His supporters had taken over the porch of the building. Cries of "long Live Mulayam Singh," filled the air.
It was a debate that was watched keenly across the country.
Every gallery in the British-built Parliament House was crowded with reporters, politicians and state legislators.
Live television coverage kept many others who could not enter the special galleries glued to proceedings.
For two days the lower house of parliament saw members speak along expected lines.
The communists accused the Congress party of betrayal; the BJP steered clear of criticising the India-US nuclear deal and harped on about rising prices and the vast mass of poor Indians.
On Tuesday afternoon, the debate continued according to script.
Voting was expected to take place late in the evening. One MP rambled through his speech; most members seemed disinterested in what he had to say.
Within minutes all hell broke loose. There was chaos.
Manmohan Singh was drowned out in the chamber during the raucous debate
Three members of the opposition BJP walked up to the table where officials sat and from a black leather bag pulled out bundles of money they claimed they had been offered in order to switch sides.
BJP members were on their feet accusing a regional party leader from Uttar Pradesh of offering them bribes.
It was a free-for-all with members from the governing party and the opposition accusing each other.
Calling each other names and chanting, they brought the proceedings to a standstill. The debate in the house was adjourned for two hours.
The prime minister went into a huddle with Congress president Sonia Gandhi and advisers.
The Speaker met senior leaders to discuss a situation that is unprecedented in India's 60-year-old parliamentary history - never before have wads of cash been brandished inside parliament.
Outside in the corridors discussion changed from whether the government had enough MPs to allegations of vote buying, which are now being investigated.
Smaller parties crucial
After two hours the debate resumed.
The prime minister was to speak before a vote was called for.
But he was drowned out by the noise in the chamber and he passed on the text of the speech he would have made for the Speaker to circulate.
Anyway, the Congress seemed to have other plans. Members of smaller parties were fielded to speak in support of Manmohan Singh's government.
Congress MPs had not said a word against the communist parties whose virulent opposition to the India-US civil nuclear deal had brought the government to the brink. After all, the two might come together after the next parliamentary elections.
Instead, two Muslim MPs stood up.
Rather than targeting the usual suspects, the Hindu nationalist BJP, they attacked the communists, who have tried to paint the deal as bad for Muslims because they say it will force India to back American policy on Iran and Israel.
One MP, Asaduddin Owaisi, tore through the communist argument.
"This deal is not between religions and communities. It is between two countries of India and United States. Why are you dragging Muslims into this?"
Congress members went wild, thumping and cheering.
Their cheers got even louder when it became clear the government had won the day.