A gun stolen during a raid on a west Belfast home was later used in a dissident republican mutilation attack on a Catholic, the High Court heard on Wednesday.
The loaded Czech-made semi-automatic pistol was then discovered in the bedroom of another house in the city, prosecutors said.
Police have charged a 23-year-old man with an arms offence after DNA from the weapon was matched to their database.
Sean Megaw, of Glasvey Drive, Dunmurry, is accused of possessing a firearm and ammunition in suspicious circumstances.
During his failed application for bail a Crown lawyer said the pistol and a shotgun were seized during an aggravated burglary last year.
Three masked men went into the house where the weapons were being legally held and claimed to be from the IRA, according to the prosecution.
A judge was told ballistic examinations have confirmed the pistol was used in a shooting incident in the Twinbrook area last May.
Crown counsel Tessa Kitson said a man found bleeding from his thigh and ankle had been shot at point blank range.
She told the court police believe the Continuity IRA were responsible.
Following the subsequent recovery of the weapon from a house unconnected to Megaw tests were carried out on it.
It was alleged that DNA profiles found on the gun matched those of the accused, whose details were on the police database due to a motoring incident.
Searches of Megaw's home in February led to the seizure of two rounds of ammunition, three balaclavas, and a radio jamming device, the court heard.
Opposing bail, Mrs Kitson said: "Police say their investigation was involving general dissident republican activity in west Belfast."
Joe Brolly, defending, argued that Megaw had a clear record and no connections to paramilitaries.
The barrister made clear there was no claim that his client was linked to stealing the gun, the house where it was found, or any connected violence.
"He is not on the paramilitary wing at Maghaberry (Prison)," Mr Brolly added.
However, the judge rejected claims that delays in the case warranted Megaw being released.
Refusing bail, Mr Justice Treacy said: "I'm not persuaded that is so.
"I'm not satisfied this is a suitable case for bail or that the delay is of a magnitude that would justify the court in releasing the applicant."