Where any railroad company in any city shall maintain along its roadway where the same adjoins a public highway, a fence or embankment four feet high and sufficiently close and strong to prevent children and horses from going through the same, or where its tracks shall be laid in a cut at least four feet deep, and shall provide on each side of the track at any highway crossing in such city a gate of like height and sufficiency, and cause the same to be closed at least half a minute before any train crosses such highway and until the train shall have passed by, the company may run its trains in said city over the portion of its railroad thus protected and over the portions not adjoining or crossing any highway at such rate of speed it deems proper.
In the absence of such protection and safeguard the company shall be bound by lawful and reasonable municipal ordinances regulating the speed of its trains along streets.
N.J.S. § 48:12-48