BEIRUT, Lebanon — Two of Lebanon’s most prominent Christian politicians — one a crucial political ally of Hezbollah, the other its longtime foe — struck a surprise agreement on Monday that could help end the standoff that has left the country without a president for nearly two years.

In the deal, Samir Geagea, the leader of the Lebanese Forces party, threw his support behind the presidential candidacy of his lifelong rival, Michel Aoun, whose Free Patriotic Movement is Hezbollah’s main Christian ally in Parliament.

It was a remarkable development even in the context of Lebanon’s constantly churning politics. The two men are bitter adversaries. Their militias fought bloody battles during Lebanon’s civil war a quarter-century ago, and they have been on opposite sides over the most radioactive issues in Lebanon: Israel and the war in Syria.

If the deal sticks, Mr. Geagea’s move could throw the political alignments of the last decade into turmoil and strike a blow at Saad Hariri, the leader of the Future Movement, which is the largest Sunni party and the main political rival of Hezbollah, the most powerful Shiite organization.