“Peace and prosperity prevail among virtuous neighbors,” reads a Chinese inscription atop the gate of Ping Yuen.

The axiom from Lao Tzu, a philosopher in ancient China, serves as a wish and reminder for those living in the five high-rise buildings spanning two blocks of Pacific Avenue in San Francisco’s Chinatown. But in the affordable housing project’s 70-year history, peace and prosperity have been less frequently seen than protests and poorly maintained facilities.

The elders who live at Ping Yuen, better known as the Pings, say they have been largely ignored by city administrators in the past as they’ve waited for better security and energy efficiency retrofits. But through a combination of federal, city and private funds, developers at the Chinatown Community Development Center recently overhauled the five Ping Yuen buildings, which housing advocates say has finally brought dignity and comfort to residents.

Chang Jok Lee moved into Ping Yuen with her family in 1952, when the buildings — the first federal housing in San Francisco’s Chinatown — were advertised as “modern, pleasant” accommodations. Within years, though, the city fell behind on maintenance, and the complex went into disrepair.

“In the past, I would shut the windows before going to sleep,” Lee said. “Sometimes, you’d hear people getting shot or fights around here.”

As her eight children grew up in the buildings, Ping Yuen, which translates to Tranquil Gardens, deteriorated. The San Francisco Housing Authority delayed crucial maintenance, Lee said, and the quality of life plummeted.

The 1978 rape and killing of 19-year-old garment factory worker Julia Wong in a Ping Yuen stairwell caused fear and anger among the community. It wouldn’t have happened, residents said, had administrators kept up with elevator maintenance and discouraged crime with more security.

Wong’s death spurred a months-long rent strike with a demand of guards, new gates and window bars. The city met these demands just days before Christmas that year.

In the decades since, agitated residents accused the city of not addressing aging infrastructure and providing insufficient security. In the 2000s, residents complained of homeless men coming into the laundry room for a warm place to sleep.

“The government officials have known me for decades, and for a long time I had hoped they would just give in and help us,” the 92-year-old Lee said, rattling off a list of needed fixes she repeatedly complained about in recent years, including broken water heaters and out-of-service elevators.

Housing officials point to chronic underfunding as a reason to put off costly fixes.

“The Housing Authority always has been driven to check into every inquiry, every concern, every complaint and every suggestion that it could,” said Rose Marie Dennis, a Housing Authority spokeswoman.

Lee still lives at Ping Yuen, where whispers of Toishanese and Cantonese float through the hallways. But physically it’s a much different place than it was in 1978.

In 2013, the late Mayor Ed Lee replaced nearly the entire roster of Housing Authority commissioners, citing agency mismanagement. Lee, who had co-organized the 1978 tenants’ strike as a law student, directed officials to offload some properties to nonprofits better suited to renovating affordable housing projects.

With the mayor’s direction and a push for federal funding from the Housing Authority, the Chinatown Community Development Center leveraged housing tax credits and debt financing from the federal Rental Assistance Demonstration program to jump-start sorely needed rehabilitation plans.

“One of the best things Mayor Lee did was push the RAD program to put at least half of the public housing stock under nonprofit ownership and management all over the city, in every single neighborhood,” said Gordon Chin, the Chinatown Community Development Center’s former director.

The Pings and two properties in North Beach were Lee’s first choices to bring under the development center’s control. Because the organization would oversee only a handful of projects, Chin said, it would be easier to address systemic issues raised over decades.

“It’s about accountability and organizations that have roots in the community,” Chin said.

Taking over the property, however, was far easier than gaining residents’ trust. When the center first proposed changes, most people feared evictions would follow.

In 1977, mass evictions occurred a couple of blocks away at the International Hotel on Kearny Street, where dozens of elderly Asian Americans and blue-collar workers were forced to vacate so the city could raze the building.

“When the tenants heard about the massive undertaking, there was a lot of fear and distrust of the San Francisco Housing Authority,” said Donna Chan, a development center organizer.

Chan and other organizers went door to door to ask about safety and sanitation issues at the buildings. Tenants didn’t hold their breath expecting positive changes.

The Housing Authority said that staff, along with organizers from the Chinatown Community Development Center, met extensively with the residents and new management to prepare for the conversion to voucher-based housing and temporary relocation.

“Nothing was done in a vacuum,” Dennis said. “It was done very collaboratively.”

Months of community meetings were organized in partnership with Ping Yuen’s tenants association to discuss the top priority: fixing the front gate at 711 Pacific, which development center Deputy Director Cindy Wu called “too porous.”

Robberies and assaults were still common just outside the gates, most notably when a man sexually assaulted a 74-year-old resident in 2016.

Organizers promised residents, who moved out so workers could retrofit the 429 units and modernize appliances, that they would be welcomed back after repairs were made.

The last of those tenants are moving home at the end of this month, which also marks the 40th anniversary of the tenants strike. After being displaced for up to a year, residents are finding their anxieties are subsiding as their temporary displacements end.

Two electronic gates now offer peace of mind to the people who call Ping Yuen home. Antique pipes and stovetops have been replaced. Bilingual staff visit elderly residents in their apartments regularly to provide updates on maintenance requests, rather than relay messages about three- to six-month delays. The day care has also been renovated, and dozens of children now play in a colorful outdoor enclosure.

Lee’s ground-floor apartment sits next to the day care, where children’s shrieks and laughter filter in through an open window. Before the development center renovated the buildings, Lee said, she was terrified of potential robbers and kept her window shut, even though it was barred.

“Back then I was scared, and now I feel like it’s a lot safer,” Lee said. “I sleep very well.”

After nearly four decades of organizing, Ping Yuen’s quality-of-life problems appear to be a chapter from the past.

“Residents feel like, ‘I own this place now. This is finally my home, and I can settle down without worrying each day what is going to happen in my house or in this community,’” Chan said.

Gwendolyn Wu is a San Francisco Chronicle staff writer. Email: gwendolyn.wu@sfchronicle.com Twitter: @gwendolynawu