Suspected militants attacked a security force's camp near the city of Gujrat in Pakistan's Punjab province on Monday, killing six soldiers and a policeman.
Five soldiers were injured in the pre-dawn attack, officials said.
TV news channels reported that the security personnel were attacked by a group of gunmen shortly after they had offered their morning prayers.
The gunmen, who were using cars and motorcycles, fled after the shooting. The military confirmed the incident and the casualties in a brief statement.
It said seven security personnel, including a police official, were killed and five others were injured "due to firing by unknown assailants near Wazirabad", a town located 12 km from Gujrat city.
The security personnel were part of a small rescue party that had camped on the bank of Chenab River, the statement said.
The injured victims were taken to the nearest military hospital in Gujranwala district, the statement said.
No group has claimed responsibility for the incident.
The attack occurred hours after thousands of supporters of the Defa-e-Pakistan Council arrived in Gujrat as part of a "long march" to protest the government's decision to reopen North Atlantic Treaty Organisation's supply routes to Afghanistan.
The DPC is an alliance of over 40 religious and extremist groups, including the Jamaat-ud-Dawah and the banned Sipah-e-Sahaba. The DPC is opposed to the transportation of supplies for foreign troops in Afghanistan through Pakistani territory.
The supply routes were closed last November after a cross-border NATO air strike killed 24 Pakistani soldiers. The government reopened the supply lines last week after the US apologised for the NATO attack.