A man accidentally shot himself in the leg Friday night in the Back of the Yards neighborhood on the South Side.

The 39-year-old was walking about 10 p.m. in the 1600 block of West 47th Street when a handgun inside his pants pocket discharged, Chicago police said.

He was shot in the leg and taken to the University of Chicago Medical Center, where his condition stabilized, according to police.

The man had a license to carry the weapon, police said, so no charges were filed.