Irish Prime Minister and Fine Gael leader Enda Kenny and his wife Fionnuala vote in Castlebar, western Ireland, Feb. 26, 2016. Paul Faith/AFP/Getty Images

Ireland's two largest political parties have agreed to meet early next week for talks on how one might support the other to form a minority government and avoid a second general election.

The smaller of the two, Fianna Fail, on Thursday rejected an offer from the Fine Gael party of acting prime minister Enda Kenny for a grand coalition between the historical center-right rivals.

That leaves a minority government, in which one party abstains in key parliamentary votes to allow the other party to govern, as the only realistic way to avoid a repeat of the Feb. 26 general election.

But both sides say the details of any such agreement would be crucial in determining its viability.

The two parties on Saturday published a statement saying the talks would "discuss how a viable minority government would work."

Parliament is due to sit on Thursday to attempt for the third time to elect a new prime minister.

Kenny's Fine Gael would be the heavy favorite to lead a minority government as it has 50 seats to Fianna Fail's 43 in the 158-seat chamber. But both would need the support of independent deputies and Fianna Fail could theoretically edge ahead if it secures enough of them.