ISLAMABAD, Pakistan — Hundreds of militants crossed over from Afghanistan to attack a Pakistani military outpost Sunday, officials said, in an illustration of the merging of the Taliban insurgency on the two sides of the border.

The attack pointed up the growing boldness of militants operating in the lawless tribal areas abutting Afghanistan at a time when Pakistan has diverted some forces to the frontier with India.

While stepping up their campaign against government troops, the insurgents also employed extreme forms of cruelty to intimidate civilians in the tribal areas. Hospital authorities in Khar, the main town in the Bajaur tribal agency, said over the weekend that militants had chopped off the ears of five captured members of a local committee organized to keep the Taliban out of town.

In the confrontation in Moh mand Agency, a neighboring district to Bajaur, Pakistani officials said at least 40 militants and six soldiers were killed in fighting near a military camp close to the Afghan frontier. As many as 600 fighters massed for the predawn assault, attacking the remote outpost with rockets and mortars, according to Pakistani authorities and news reports.

The camp’s defenders managed to fight off the attackers, but clashes in the area continued for some hours, according to a military statement.

In addition to the six government troops killed, seven were injured, and local tribal authorities said militants were believed to have captured at least five soldiers. Many troops abducted in battle are later beheaded by insurgents.

Analysts said the Mohmand fighting reflected stepped-up coordination between Taliban commanders in Afghanistan and in Pakistan and underscored the ease of movement by militants across the rugged, poorly demarcated border.

The flow of fighters from sanctuaries in Pakistan’s tribal areas into Afghanistan is a well-documented phenomenon, but instances of militants using the Afghan side of the frontier as a staging ground for an attack against Pakistani targets are rarer.

Insurgents also may perceive that Pakistan is preoccupied with guarding its eastern border with India rather than focusing on the fight against militants along the frontier it shares with Afghanistan, analysts said.

Frontal attacks by militants on Pakistani military positions, as opposed to hit-and-run skirmishes, are somewhat unusual but could become more common if insurgents’ surveillance — which tends to be thorough and constant — turns up indications that a particular post is vulnerable, analysts suggested.

The soldiers targeted in Sunday’s assault were not regular army troops but were from the less well-armed and well- trained Frontier Corps, a paramilitary force that operates in the border zone.

Meanwhile, NATO supply routes through Pakistan, menaced for months by insurgents, have come under new pressure.

Most previous attacks have centered on the historic Khyber Pass near Peshawar, but on Sunday insurgents blockaded a road leading to a lesser-used southern crossing into Afghanistan, at Chaman.

About three-quarters of NATO and U.S. military supplies for troops in Afghanistan pass through Pakistan.