Rahul Gandhi, the scion of India's most famous political dynasty, took over as president of the main opposition Congress party. Picture: Reuters/Amit Dave/File photo

New Delhi — Rahul Gandhi, the scion of India's most famous political dynasty, took over as president of the main opposition Congress party on Saturday while facing a stiff challenge from Prime Minister Narendra Modi's ruling Hindu nationalists.

Gandhi, who took the mantle from his mother, Sonia Gandhi, at a party function, takes over the leadership of a party that has been losing power to Modi's Bharatiya Janata Party since 2014. Gandhi's party has suffered humiliating defeats in recent state elections despite his active campaigning to win back support.

In a speech, Sonia Gandhi described her son as a new hope for the Congress as party workers danced, burst firecrackers and distributed Indian sweets to celebrate the generational shift in the leadership.

Gandhi, 47, will be taking on Modi when the prime minister seeks a second five-year term in 2019. Modi has vowed to create a Congress-free India while working for the rise of Hindu nationalist forces.

In his speech, Gandhi described himself as an "idealist" and said Indian people were getting disillusioned by policies pursued by the Modi government.

He said the Congress party, which had ruled India for decades, took the country into the 21st century through modernization and development. He accused Modi of taking India "to a medieval path where people are butchered because who they are, beaten for what they believe in and killed for what they eat."

"The Congress will take on this challenge and will never back down," he said.

Gandhi was referring to killings and attacks on minority groups, especially Muslims, since the Bharatiya Janata Party swept national elections in 2014. Most of the violence against Muslims has involved fringe Hindu vigilante groups that have become active in small towns and cities across India. Muslims make up about 14 percent of India's 1.3 billion people and Hindus about 80 percent.

Gandhi is the sixth member of the Nehru-Gandhi family to lead Congress. His father, Rajiv Gandhi, grandmother Indira Gandhi and great-grandfather Jawaharlal Nehru have all served as prime minister since India's independence from British colonialists in 1947. Rahul Gandhi entered politics in 2004.

"Today, the Congress faces a possibly existential crisis even as Sonia Gandhi makes way for Rahul Gandhi to head the party," said Neerja Chowdhury, a political commentator."

Gandhi was elevated as the party's vice president in January 2013, serving as his mother's No. 2. Sonia Gandhi, 71, stepped down on Saturday as the party's longest-serving chief, leading the party for 19 years. She has been unwell in recent years and pushing her son to the fore.

Asked what role she would play after her son's elevation, she told the New Delhi Television channel on Friday, "My role is to retire."

However, Randeep Surejewala, a party spokesperson, clarified that Sonia Gandhi retired as party president and not from politics.

"Her blessings, wisdom and innate commitment to Congress ideology shall always be our guiding light," he tweeted.

The Gandhi family and the Congress party have released little information about Sonia Gandhi's health problems. She had surgery in the United States for an undisclosed reason in 2011, and has returned to the US for regular checkups since then.

Associated Press