Three terrorists, who, according to reports, had attacked the Delhi-bound Shalimar Express, were killed in an encounter in Akhnoor town, about 35km from Jammu, early Monday.
The terrorists killed five persons while trying to cross over to the other side of the border.
After attacking the train, the terrorists trekked about one and a half kilometres, stopped a car at Gagwal on the Jammu-Pathankote highway and fired on the occupants, killing two and injuring four, according to a police spokesman.
The terrorists, wearing combat dresses, pushed out the dead and the injured from the vehicle and forced the injured driver, Vikas Singh, to take them towards Jammu, he said.
They abandoned the vehicle at Mahespura Chowk in the city and took another vehicle and headed towards Akhnoor in a bid to cross over to Pakistan.
At Akhnoor bridge, jawans stopped the vehicle and asked them to produce their identity cards. But the terrorists opened fire killing one jawan on the spot and injuring two.
The terrorists tried to escape in another vehicle but were fired upon by other security guards, forcing them to leave the vehicle. They rushed towards Ambran road and initially took shelter in an army auditorium.
The terrorists fired from the auditorium when security forces challenged them. Later they came out and spread in different directions when the army cordoned off the area.
In the exchange of fire, the terrorists were killed; two soldiers lost their lives and four were hurt.