The Colt .22 handgun with which a 12-year-old Queens boy accidently shot his sister in the abdomen Friday was the same weapon used in the fatal shooting earlier this week of a man who lived in the same Jamaica neighborhood, law-enforcement sources said.

The boy told cops he found the gun, but police searched his family’s home looking for clues in Tuesday’s murder of technology worker Mohamed Hamwi, sources said.

Hamwi, 48, had taken the LIRR to the Jamaica station and was walking to his home at 173-47 105th Ave. with his earbuds in at about 12:15 a.m. when he was shot twice at 105th Avenue and 173rd Street, cops said.

Police believe it was a robbery gone bad because the victim still had his iPhone and about $200 in his wallet when his body was found.

The boy involved in Friday’s shooting was playing with the gun in the family’s Jamaica home when he blasted his 14-year-old sibling, police said.

The shot tore through the girl’s abdomen and exited through her back.

She was rushed to Jamaica Hospital, where she was in stable condition and “doing well,” a relative said.

Police sources said the brother did not intentionally shoot his sister, but he had ignored a family friend’s warning to put down the gun and was charged with weapon possession.

“She tells him, ‘What are you doing? Stop playing with the gun,’ ” a source said. “The boy says, ‘Don’t worry about it’ — and starts pulling the trigger.’’

Several people — including the siblings’ mom, Silvia Peralta, her boyfriend and at least two other adults — were in the apartment when the girl was shot at around 2:25 a.m.

Police questioned the boy at the 103rd Precinct station house Friday.

He was taken to Family Court, where a judge booted the media from the courtroom.

After the hearing, his mother huddled with employees from the city Administration for Children’s Services, which is investigating. Sources said the boy, who a relative reported is suspended from school, was recently busted for trespassing, and police have been called to his home for incidents involving him.

Hamwi is a native of Syria who lived in Canada before moving to the United States.

Additional reporting by Georgett Roberts and Dana Sauchelli