Shimla, Dec 20: The Congress today wrested power in Himachal Pradesh by getting a simple majority in the state assembly, with its candidates winning 36 of the 68 seats.
Election Commission officials said the ruling Bharatiya Janata Party (BJP) had won 24 seats and was leading on two seats.
Independents, mainly BJP rebels, won four seats and were leading on two seats.
Chief Minister Prem Kumar Dhumal won from Hamirpur, defeating Narinder Thakur of the Congress by 9,302 votes.
Congress veteran and five-time chief minister Virbhadra Singh, who led the party's campaign in the state, was elected by a record margin of 20,000 votes.
"We are forming the next government," he triumphantly told the media.
Admitting BJP's defeat, Dhumal told reporters in Hamirpur, his home constituency: "My victory does not matter. I am sad the party has lost in Himachal."
The four independents who won the elections are: Congress rebel Kirnesh Jung from Paonta Sahib, Balbir Singh Verma (Chopal) as well as BJP rebels Pawan Kajal (Kangra) and Rajinder Singh (Sujanpur).
In 2007, the BJP had won 41 seats, the Congress 23, the Bahujan Samaj Party one and independents three.
The lone BSP legislator later joined the BJP.