Indian Prime Minister Atal Behari Vajpayee has resigned as his governing BJP party heads to defeat in India's general elections.
Sonia Gandhi and Mr Vajpayee - about to change roles?
The president has accepted his resignation and asked him to continue until a new prime minister takes over.
With most results in, the main opposition Congress party is well ahead of the BJP-led governing alliance.
Mr Vajpayee called the poll six months early - but all the signs are that the move has backfired.
Nearly 380 million people voted in elections held over three weeks.
The BBC's Adam Mynott in Delhi says it is the huge unspoken mass of Indians, largely ignored by the BJP and who have no electricity, poor sanitation and filthy water who have spoken.
Mr Vajpayee held a last meeting of his cabinet before driving to the presidential palace to submit his resignation to President Abdul Kalam.
He did not speak to the media but is due to address the nation shortly.
"As we have not got the mandate of the people we have decided to sit in the opposition," BJP president Venkaiah Naidu told journalists.
Counting of votes has been taking place in 1,214 centres across the country.
Projections of the final results on state television place the opposition Congress-led alliance ahead of the BJP and its allies.
But the Congress, led by Italian-born Sonia Gandhi, will have to seek support from smaller parties, including the Communists, if it wants to form the next government.
It is still not clear if Mrs Gandhi will be India's new prime minister or if Congress will nominate someone else to the post.
Her critics oppose her on the grounds of her foreign origin and her lack of experience.
But Congress' campaign was energised by the entry of her son Rahul, the fourth generation of the Nehru-Gandhi dynasty to join politics.
He won by over 100,000 votes in the constituency of Amethi in north India, a seat once held by his father, former Prime Minister Rajiv Gandhi.
In its first reaction, Pakistan said it hoped the peace process between the two countries would continue.
"The desire for peace is not linked to individuals," Information Minister Sheikh Rashid told AFP.
Dancing in the streets
"Everyone is stunned by this result," top BJP official Pramod Mahajan told the BBC.
Congress supporters took to the streets of Delhi, dancing with joy and setting off firecrackers, as soon as the first results came in.
"We feel vindicated," Congress spokesperson Ambika Soni told BBC News Online.
"This result show that this party is for the common man."
Congress' surprise showing has been made possible by huge wins in the key southern states of Andhra Pradesh and Tamil Nadu, where it won the bulk of the seats along with its allies.
In another upset, Congress has won 12 out of 26 seats in Gujarat, a state rocked by anti-Muslim violence two years ago.
COUNTING THE VOTES
543 constituencies in 28 states
About 675m registered voters
One million voting machines
Turnout across four phases was about 56%
Main contest between BJP and Congress alliances
Repolling ordered in four constituencies
The BJP, whose state administration was blamed for doing little to prevent the violence, was expected to do very well there.
If neither the BJP or Congress wins an outright majority, they will begin to woo smaller parties to try to form a government.
India's president, APJ Abdul Kalam, has also been in discussions with legal experts about who should be asked to form the next administration following a hung parliament.
Normally in that case the party with the largest number of seats is given time to prove its majority.
India's financial markets, which dropped when counting began on Thursday, have rebounded after signs that the Congress was ahead.
Traders had feared the government's privatisation plans would stall if Mr Vajpayee did not return to government.
Analysts believe policies will have to be adapted to take in their concerns.
Only 539 of the 545 seats in the lower house, or Lok Sabha, are being counted on Thursday.
Results are coming in much faster in these elections because all voting was conducted using electronic machines.
Repolling has been ordered in three seats in the eastern state of Bihar because of irregularities and in one seat in Manipur because of a landslide. Two seats are appointed by the president.