An Iranian strike on Pakistan this week that drew a rapid military riposte and raised fears of greater regional turmoil was driven by Iran's efforts to reinforce its internal security rather than its ambitions for the Middle East, according to three Iranian officials, one Iranian insider and an analyst.

Both the heavily armed neighbors, oftentimes at odds over instability on their frontier, appear to want to try to contain the strains resulting from the highest-profile cross-border intrusions in recent years, two analysts and two of the officials said.

Iran sent shock waves around the region on Tuesday with a missile strike against what it described as hard-line Sunni Muslim militants in southwest Pakistan. Two days later, Pakistan in retaliation attacked what it said were separatist militants in Iran — the first airstrike on Iranian soil since the 1980-88 Iran-Iraq war.