Samih Maayta, the Jordanian minister for media and communication, said that eight militants — extremist Salafis, he said, a group banned in Jordan — attacked a military position "with heavy arms" at 10:30 p.m. In the ensuing gunfight, Cpl. Mohamad Abdulla Manaseer Abbadi became the first member of Jordan's military to be killed in action related to Syria's civil war.

The Associated Press reported that the militants, whose nationalities Mr. Maayta did not provide, were trying to enter Syria illegally to join the rebel forces fighting President Bashar al-Assad's regime.

Two hours later, Mr. Maayta said in an interview that an additional five men suspected of ties to Al Qaeda tried to penetrate the border and clashed with soldiers. One was severely injured, but there were no Jordanian casualties. All 13 involved in both episodes were arrested.

On Sunday, the government said it had arrested a group of 11 Jordanians who had obtained explosives and other weapons from Syria that they intended to use in simultaneous assaults on civilian and government targets, including malls and the American Embassy.

Together, the episodes are the latest signs of how the chaos in Syria is destabilizing its neighbors. Jordan, an important American ally, has increasingly aligned itself with Syrian rebel forces, delivering humanitarian aid to rebel-held cities and hosting about 200,000 Syrian refugees.

Mr. Maayta, the government spokesman, said on Sunday that the foiled attack had been planned since June by a group of Jordanians calling themselves 11-9 the Second, a reference to a string of hotel bombings in Amman that killed 60 people on Nov. 9, 2005. He said the group had been staking out targets for months and planned to use car bombs, machine guns, mortars and other heavy weapons in an attack that could have killed hundreds.

Jordan's General Intelligence Directorate "had all their activities under surveillance," Mr. Maayta said. "The group's experiments concentrated on creating explosives that would do the maximum damage and cause the highest losses."

Jordan, which has a peace treaty with Israel, is considered an important island of relative stability in a volatile region. A spokesman for the office of Prime Minister Benjamin Netanyahu of Israel declined to comment on Sunday evening about whether the Israeli intelligence services had assisted the Jordanian authorities in the case.

Mr. Maayta said that the group had traveled to Syria and was planning to take advantage of the chaos there to obtain weapons, including dynamite, that they planned to add to existing explosives to increase their power. He said the group had taken "counsel from Al Qaeda in Iraq via the terrorist sites on the Internet," and had posted its plans online "to enable others to be able to create the same explosives."

Al Qaeda in Iraq is a Sunni insurgent group that American intelligence officials have described as mostly homegrown, with some foreign leadership.

Most of the targets of the plot were said to be in the affluent Abdoun neighborhood in the southern part of Amman, home to several upscale nightclubs that are popular with young Jordanians and tourists. The plans apparently included suicide bombers, exploding cars, machine-gun fire and tossed grenades.

"They were targeting foreign diplomats in hotels and in public places," Mr. Maayta said. "They were starting to target two main malls."

He said the intelligence service seized weapons, computers, cameras and forged documents in connection with the arrests.

Ranya Kadri reported from Amman, Jordan, and Jodi Rudoren from Jerusalem.