A fence outside a Bronx elementary school that had drawn attention for its lack of safety and controversy over who was responsible for repairs is getting a long-awaited makeover. 

Damaged during superstorm Sandy, nearly half the fence, attached to a concrete wall that stands between the tracks where Amtrak’s Acela Express trains run and Longfellow Avenue where the Bronx Charter School for the Arts is located, had toppled over onto the dead-end block.

The Department of Transportation and Amtrak both denied ownership, but on Wednesday, the DOT said it was completing installation of a new fence.

“In the interest of public safety, DOT removed the dangling fence and is installing an 8-foot high 2-inch mesh chain-link fence by the end of the day,” a DOT spokesperson said in an emailed statement. “We will continue to research the ownership status of the retaining wall/fence.”

While no injuries had been reported, the “rusty, jagged fence” had remained a safety concern as students often play on the block during their recess, Kenneth Garger, spokesman for State Sen. Jeff Klein, said on Tuesday.

Klein and principal Brenda Daniels demanded Tuesday afternoon that Amtrak and the city’s DOT settle the dispute over which agency owns the fence and replace it.

“In this day and age, and in this city, it is unacceptable for such a simple repair to be put off for this length of time,” Klein said in a statement. “While these two agencies pass the buck over who owns what, our children are being subjected to this unnecessary safety hazard.”

Back in February, Amtrak officials said ownership of the fence was transferred to the city in the 1950s, but the city says it has no record of the transfer, according to Klein.

Since then, repairs had been in limbo, Garger said.

Amtrak spokeswoman Kimberly Woods said a temporary barrier was placed in front of the wall to block access to the damaged fence, but it was not there on Tuesday.