MUMBAI - Indian Prime Minister Narendra Modi's party is returning to power in the country's richest state, Maharashtra, giving it a fillip ahead of the 2024 national election after an unlikely ruling alliance of parties crumbled after more than two years.

Modi's Bharatiya Janata Party will now form the government in Mumbai's home state along with a faction of the regional Shiv Sena party, which surprised analysts by tying up with ideologically opposed parties such as Congress after the 2019 state election to oust the BJP.

Both the BJP and the Shiv Sena draw their support mainly from the majority Hindu community.

The head of the breakaway Shiv Sena faction, Eknath Shinde, will take oath as chief minister later on Thursday though the BJP has more seats in the state assembly.

"It's a natural alliance with the BJP," said Shinde, seated next to former BJP chief minister of Maharashtra, Devendra Fadnavis.

Maharashtra sends the most number of lawmakers to parliament after the northern state of Uttar Pradesh, which is also ruled by the BJP, and being back governing the state could give the party a boost in sentiment as it heads towards 2024.

Uddhav Thackeray, head of the Shiv Sena that now stands split, resigned late on Wednesday from the chief minister's post.

(Reporting by Rajendra Jadhav and Shilpa Jamkhandikar; Editing by Alison Williams)