Mark Anthony Patrick Kerr, 26, of Carrabane Walk and Michael Anthony Taylor, 45 of Bishop Street, pleaded guilty in January at Belfast Crown Court to possessing the Magnum rifle in the city with intent to endanger life almost three years ago.
Kerr also pleaded guilty to possessing a length of commercial detonating cord in suspicious circumstances on the same date on Tuesday, 2 August 2011.
Taylor was sentenced to seven years, with three years to be spent in custody and four on licence after his release.
His co-accused Kerr was sentenced to six years, with half in custody and half on licence.
A prosecution lawyer told Belfast Crown Court that the guilty pleas to having the rifle were accepted on the basis of "second limb possession", in that they were holding the weapon for someone else intending to endanger life or cause injury to property.
A charge of possessing the rifle under suspicious circumstances was "left on the books" and was not proceeded against both men.
Similarly, in Kerr's case, a charge of possessing the detonating cord with intent to endanger life was also "left on the books".
The crown lawyer told Judge Corinne Philpott QC that on 2 August, 2011, police were carrying out a surveillance operation in Derry both on the ground and in the air.
He said that night that around 8.02pm police stopped a red Peugeot 406 which was being watched by police who noticed the driver, Kerr, was wearing white gloves.
"After the car was stopped, Kerr was seen to take the gloves off and put them in his lap," said the lawyer.
A search of the car revealed a red holdall bag containing a semi-automatic Remington Model 597 Hornady Magnum .117 rifle.
"He was taken from the car and indicated that the car belonged to him and said: 'I have been told to drive the car with the bag to the Square.'"
The deputy Belfast Recorder was told that Kerr denied being a member of a paramilitary organisation.
The court heard that unknown to both Kerr and Taylor, police had mounted a covert surveillance operation that evening and both men were being closely followed by police officers both on the ground and in the sky above Derry.
The prosecuting lawyer said that Taylor was observed going into the Abercorn Bar and as he left aerial police watched him walking down the hill.
Taylor was later seen by police talking into the passenger window of Kerr's red Peugeot car.
Police then moved in, arresting Kerr at the car, and Taylor was detained a short distance away.
Judge Philpott was told that Taylor was found to have a green plastic bag with another bag inside complete with tag.
The crown lawyer said it was connected to the holdall found in Kerr's car, but during police interview Taylor claimed the bag was thrown at him by a motorist after they had an altercation.
During an extensive search of Kerr's car, police recovered a metre-long length of detonating cord which contained the explosive PETN inside.
The judge was told that Kerr had no relevant criminal convictions.
However, the lawyer said that Taylor was jailed in 1995 at Belfast Crown Court for an explosives offence.
The court heard that on 27 January, 1994, Taylor was seriously injured in a bomb explosion in Derry.
The force of the explosion knocked down a wall and in a follow up operation, police recovered a Mark 16 mortar and fins which appeared to be in the process of "setting it up to be fired" when the bomb detonated prematurely.
Defence lawyers for both Kerr and Taylor said that an expert who examined the rifle said if fired, it was not capable of injuring anyone.
Meanwhile, detectives from Serious Crime Branch have welcomed the sentences.
A spokesman from the branch said: "We should all be thankful that those in possession of these items were prevented from using them. Police will continue to combat the threat posed by dissident individuals and groups who plan to use violence to further their agendas.
"We would encourage people in the community to continue to work with us to reduce the threat posed by such reckless individuals so that we can bring them before the courts."