An alleged gunman has been arrested for shooting a 20-year-old man outside of the victim’s Hempstead home two weeks ago, Nassau County police said.

A judge ordered Brian Thomas held without bail after he was charged with attempted murder and criminal possession of a weapon.

Special Investigations Squad detectives alleged the 22-year-old suspect, who is also from Hempstead, fired gunshots at the victim on Henry Street shortly after 5 p.m. Monday, Aug. 5.

The victim was taken to a local hospital where he is listed in critical but stable condition.

Hempstead village police officers apprehended Thomas on Fulton Avenue without incident Wednesday.

He is due back in court Monday.