TEHRAN — Even as the United States and Iran pursue negotiations on Tehran’s nuclear program, they find themselves on the same side of a range of regional issues surrounding an insurgency raging across the Middle East.

While the two governments quietly continue to pursue their often conflicting interests, they are being drawn together by their mutual opposition to an international movement of young Sunni fighters, who with their pickup trucks and Kalashnikovs are raising the black flag of Al Qaeda along sectarian fault lines in Syria, Lebanon, Iraq, Afghanistan and Yemen.

The United States, reluctant to intervene in bloody, inconclusive conflicts, is seeing its regional influence decline, while Iraq, which cost the Americans $1 trillion and more than 4,000 lives, is growing increasingly unstable.

At the same time, Shiite-dominated Iran, the magnetic pole for the Shiite minority in the region, has its own reasons to be nervous, with the ragtag army of Sunni militants threatening Syria and Iraq, both important allies, and the United States drawing down its troops in Afghanistan.