SEPTA is negotiating the purchase of a Southwest Philadelphia industrial parcel valued at $21.8 million for a crucial maintenance barn as it moves to modernize Philadelphia’s trolley system.

The deal comes about 18 months after the program suffered a setback when Amazon outbid SEPTA for an Elmwood Avenue lot the transit agency thought it had secured as headquarters for a new fleet of larger light rail cars to replace the current 40-year-old Kawasaki trolleys.

SEPTA’s board authorized the purchase of 13.52 acres and a former steel fabricating plant at 5100 Grays Ave., near Bartram’s Garden on the Route 36 trolley line, which runs from Center City to Eastwick.

“It just seemed to make everything fit,” said Dennis Stefanski, an engineer and senior project manager for trolley modernization. “It met a lot of our selection criteria.”

First, the site is not in a flood zone, unlike some properties SEPTA scouted farther south in Eastwick, he said. It’s in an industrial area, with few residences nearby.

And the existing building is solid, with a vast interior that includes cranes, Stefanski said. SEPTA plans to salvage about 65% of the building to form the nucleus of the heavy maintenance facility.

“The skeleton of the building is excellent,” he said.

An additional benefit: the property is centrally located and relatively close to the 40th Street portal to the trolley tunnel to Center City and could be used to deploy at least some of the fleet. Now trolleys start from several depots around the city.

It would help with “loading the lines and getting the trolleys out in the morning commute,” Stefanski said.

» READ MORE: Amazon got land SEPTA wanted. Will it delay a much-needed trolley upgrade?

SEPTA officials are negotiating with owners to buy two nearby scrap yards to be used for a rail yard and employee parking. The main property will be screened from a compact residential block to the south, Stefanski said.

The estimated $2 billion SEPTA trolley plan envisions fewer stops at fixed stations, along with faster and accessible new street cars that would carry up to 100 people comfortably, compared with the 75-person capacity of today’s models.

Updated cars would also eliminate the steep steps and narrow doors that make boarding a trolley almost impossible for many with disabilities — and difficult when traveling with a child or carrying packages.

For about a decade, SEPTA had planned to buy a 29-acre abandoned industrial site at 6901 Elmwood Ave., once home to a General Electric plant, as the location for the trolley heavy maintenance facility. It offered $5.7 million.

After Amazon showed interest and offered several times as much, the property owner rejected SEPTA’s bid. The e-retail giant said it planned to build a “last mile” warehouse on the land.

The authority’s board moved to take the parcel by eminent domain, which allows government agencies to pay fair market value for properties needed for public projects. SEPTA executives did not pursue that avenue, because, Amazon’s interest drove up the price exponentially and the courts likely would have made them pay much more than $5.7 million, CEO Leslie S. Richards said at the time.