An 18-year-old man was shot Tuesday morning outside of Melrose Elementary School just before students began arriving to campus.

Keith Bromery, an East Baton Rouge Parish school system spokesman, said the man — who had no known affiliation with the school — arrived on campus at about 7:25 a.m. When he walked into the building, someone inside asked if he needed anything, and he told them he was there to meet his cousin, Bromery said.

The man soon decided to leave the building and a custodian escorted him out, Bromery said. But shortly after he left, people inside the school heard gunshots.

The man, who was not identified, ran back to the school with what appeared to be a leg injury, Bromery said, but school employees did not let him inside.

First responders with East Baton Rouge Parish Emergency Medical Services quickly responded to the scene and took the man who had been shot to a hospital, said Mike Chustz, an EMS spokesman.

Don Coppola Jr., a Baton Rouge police spokesman, said the man suffered non-life-threatening injuries in the shooting. The man told police that “two male subjects” attempted to rob him and then attacked him as he was walking to an area restaurant for breakfast, Coppola said.

The shooting remains under investigation.

Bromery said no students were on campus at the time of the shooting, which occurred in the road just off campus.

Melrose Elementary, 1348 Valcour Drive, is just south of Greenwell Springs Road between North Foster Drive and North Ardenwood Drive.

Bromery said the school was locked down for about two hours while police investigated the shooting. He said parents were directed to drop off their children at an alternate entrance to the main one during the lockdown.

Classes began as scheduled at 8:25 a.m. while the school remained on lockdown, Bromery said. It was lifted about an hour later. Classes proceeded as normal after that, he said.

Police asked anyone with information about the incident to call the Violent Crimes Unit at (225) 389-4869 or Crime Stoppers at (225) 344-7867.

Follow Ben Wallace on Twitter, @_BenWallace.