Police say they’ve arrested a gunman who shot someone and then was wounded himself while he tried to rob an illegal gambling establishment in North Long Beach earlier this week.

Robert Rosas, a 27-year-old Long Beach resident, went to the gambling location on Artesia Boulevard near Lemon Avenue around 9:20 p.m. Monday, police allege.

When he tried to rob the place, another man intervened and ended up being shot by Rosas, LBPD spokeswoman Jennifer De Prez said.

The wounded man then returned fire with his own gun, hitting Rosas in the upper body and legs, according to the department.

Rosas was already gone when police arrived, but paramedics took the other wounded man to the hospital, according to authorities.

Later, police learned Rosas had gone to the hospital himself, De Prez said. Officers took him into custody just after midnight Tuesday at or near Long Beach Memorial Medical Center, according to an arrest log.

He was booked into jail on suspicion of attempted murder and attempted robbery, police said. Rosas remains behind bars on $1 million bail, according to jail records.

Both he and other wounded man were expected to survive their injuries, police said.

Police declined to reveal the exact location of the gambling establishment but said it “was not being used for a legitimate business operation.”

Jeremiah Dobruck is managing editor of the Long Beach Post. Reach him at [email protected] or @jeremiahdobruck on Twitter.