A pair of Brooklyn men were arrested in Hempstead after they were caught with a handgun inside their car early Saturday morning, Nassau police said.

Cops were alerted to possible gunfire across from 277 Fulton Ave. just after 4 a.m., police said. When they arrived, the officers saw several shell casings and the men who fled into a 2016 Nissan Maxima, police said in a news release.

advertisement | advertise on newsday

The cops pulled them over near Cathedral and Fulton avenues and that is when they found a Smith & Wesson .40 caliber handgun in the car, police said. Both men, identified as Eric Leath, 29, and Jonathan Copeland, 29, were taken into custody.

Leath is charged with criminal possession of a weapon in the second degree and the fourth degree, police said. He is also charged with reckless endangerment and criminal possession of a firearm, police said. Copeland is charged with possession of a weapon in the fourth degree and criminal possession of a firearm, police said.

Both are expected to be arraigned on Sunday at First District Court in Hempstead.