In 1945, a military plane accidentally crashed into the Empire State Building. There were 14 casualties and $1 million in damage, but the 1,250-foot-tall structure stayed upright. So when structural engineer Leslie Robertson was working on the World Trade Center, which would trump the Empire State by 100-plus feet, he considered jet impact.

“The towers were designed [to withstand a] 707,” the largest commercial airliner that existed in the 1970s, Robertson, 90, told The Post. “A low-flying, slow-flying 707 heading for Idlewild.” But on 9/11, two fully-fueled 767s sparked fires that weakened the Twin Towers’ support systems beyond anticipation.

The World Trade Center was destroyed, and so was Robertson.

“He lost a lot of his joy and spirit. He had to defend himself, because he was attacked, criticized and pressed by other engineers, by architects, by clients,” says architect A. Eugene Kohn in a documentary about his colleague Robertson, “Leaning Out,” premiering Tuesday at the Architecture and Design Film Festival.

A high school dropout from California, Robertson joined the Navy and studied engineering at Berkeley on the GI bill, then moved to Seattle, Wash., to work for Worthington, Skilling, Helle & Jackson, the firm tapped to help Seattle-born architect Minoru Yamasaki design the Twin Towers.

Yamasaki and Robertson had never before worked on buildings more than 28 stories. To allow the towers to rise more than 1,360 feet from relatively small bases, Robertson placed the facade columns close together and designed dampers to prevent swaying.

He was lauded when the project debuted in 1973. And after a bomb detonated in the basement of the North Tower in 1993, he was confident the towers could stand.

“I was on television a lot [afterward]. I was probably the only person on the planet who could really say that the buildings were safe … the only one who could say, ‘Hey, take the subway, and go back to work in that building,’ ” Robertson recalled. “Following 9/11, I didn’t appear on television for months. I had nothing that I could say to people to make them feel better.”

His role in the project was scrutinized as FEMA dissected his drawings — the only remaining ones, since the those of WTC operator Port Authority were destroyed in the collapse. Robertson put in 18-hour days working with investigators and dealing with the fallout.

“I got 1,000 letters from people, writing in support of my work,” he said. “But I also had people come to my office who had lost someone there. They wanted to talk.” Robertson even went to therapy sessions alongside grieving survivors.

“I did the best I could,” said Robertson, recalling a teenage girl who had lost her brother, an employee of Windows on the World, and reached out to him. “We agreed to meet in a park down at the end of Manhattan. It was very stressful … we hugged each other and cried.

‘He lost a lot of his joy and spirit. He had to defend himself, because he was attacked, criticized and pressed by other engineers.’

“[People] wanted me to somehow say [how their loved ones] died. I couldn’t do that. I wasn’t there.”

Robertson admits he feared his career was over. “I thought I was really through, through, through, through — forget it!” he recalls in the movie. “Who is going to want this guy whose building got taken down by a simple airplane?”

The FEMA investigation found that Robertson wasn’t to blame. He’s currently working with his wife and business partner, SawTeen See, on a Malaysian tower that will stand 2,113 feet. Although his firm served as the structural engineers for the rebuilt 4 World Trade Center, he avoids that area.

“I find it very difficult to go there,” said Robertson, who lives on the Upper West Side and is a father of two grown children. “I did as little as possible [on 4 WTC].”

Robertson and See have a piece of mangled steel from the 1993 bombing in the yard of their second home, in New Fairfield, Conn.

‘“It’s kind of a symbol of the great work … done to take that tremendous blast and shake it off and continue living,” he said.

And the tragedy hasn’t changed his design philosophy — as Robertson says in the film, you can’t make buildings so secure that they look like prison cells.

“Buildings should be built for people, not for attacks,” he told The Post. “The untoward events of life will probably take place, but if we design for them, then life would be a horrible place to live in … We have to think about life first.”