Matt Damon is nothing if not malleable.

He convincingly played a heroin-addicted Gulf War veteran in Courage Under Fire, a resolute paratrooper in Saving Private Ryan, and of course the memory-challenged assassin Jason Bourne, whom he portrays for the fourth time in the movie of the same name that opened July 29.

Related: THE 21-DAY METASHRED—an At-Home Body-Shredding Program From Men’s Health That Strips Away Fat and Reveals Lean, Hard Muscle

When the first trailer for Jason Bourne ran during the Super Bowl, with a glimpse of a shirtless Damon delivering a one-punch knockout with his burlap-wrapped left hand, you couldn’t help but be awed by Damon’s latest transformation.

At 45, he looks like he could wipe the floor with the relatively puny Bourne he played in IdentitySupremacy, and Ultimatum.  

Careful readers of Men’s Health won’t be surprised to learn that his trainer is Jason Walsh, owner of Rise Movement and Rise Nation in Los Angeles.

Walsh was the agent of change for Bradley Cooper in American Sniper and John Krasinski in 13 Hours

How Walsh started working with Damon is a Hollywood story almost too weird to be true. 

TRUE GRIT

When Damon signed on to star in Elysium, a sci-fi movie set in twenty-second-century L.A., the director had a vision of how his character should look.

So he attached a picture of Damon’s head to a picture of an impressively jacked physique and sent him off to hire a trainer who could put the pieces together.

Related: Normal-Sized Guys Who Are Freakishly Strong Tell You How They Did It

“They wanted him to look like a badass with his shirt off,” Walsh says. “Lean and mean.” 

But there were, as you’d expect in a Hollywood story, complications. For one, they had just a few weeks to pull off the transformation.

For another, Damon was 42 at the time, and had been working around a longstanding shoulder problem and a back injury suffered a few years before. 

“Most people that have back pain, it comes from weakness,” Walsh says. “Your glutes don’t work, your hips aren’t very stable, and your lower back ends up taking the brunt of it. It’s the first to go.”

Related: The Fit Man’s Back-Saving Workout

The problem, Walsh suspects, dates back to Damon’s appearance in a 2009 comedy.

“For The Informant! he put on a ton of really bad weight,” he says. “That was the character. He was a middle-aged American white guy who eats at Burger King four or five times a week.”

It wasn’t a ton of weight—more like 30-ish pounds—but Walsh believes the flab had lingering effects that contributed to core-muscle imbalances. 

So the first goal was to strengthen Damon’s upper back to address the shoulder problem.

The second goal was to address his back injury by improving his mobility and flexibility, while simultaneously increasing his strength. 

Then, because it’s a Hollywood story, Walsh had the added pressures of limited time, high expectations, and big money on the line.

Damon had to be buff enough to satisfy the director’s vision and healthy enough to carry a $115 million action movie, for which he was reportedly paid $20 million. 

They trained four hours a day, two in the morning and two in the afternoon. Elysium ended up with mixed reviews and did just okay at the box office when it came out in 2013.

But Walsh, at least, came through: Damon was indeed jacked.

THE DEPARTED

A year later Damon contacted Walsh again, this time with an even bigger challenge: He planned to shoot three action movies in a row, with hardly any break in between.

Moreover, he was playing completely different characters in each: an astronaut in The Martian, a civilization-saving knight in The Great Wall(which comes out in February 2017), and then the newly muscled Bourne.

They had a couple of months to get ready for The Martian, which began filming in late 2014 in Hungary.

“He just needed to look like an astronaut who takes care of himself,” Walsh says. “He had to be in good physical shape, but he didn’t need to look like a badass. So we focused on getting him back on track.”

The next stop was China for The Great Wall, an epic with a reported $135 million budget. “It was a physical role,” Walsh says, requiring Damon to ride a horse and swing a sword, often while wearing heavy armor.

Some of it was shot in the Gobi Desert. “He didn’t need to look like Jason Bourne yet, so our focus changed from aesthetics to just keeping him healthy,” he says.

But when it came time to focus on turning Damon into the leaner, meaner Bourne seen in the trailer, they had yet another complication: “We were in the middle of nowhere,” Walsh says. “We didn’t have any equipment.”

Related: How to Lose Belly Fat Fast With No Equipment: RIPTENSITY—the Bodyweight DVD From Men’​s Health 

So Walsh and Damon did conditioning work through the streets of Dunhuang in northwestern China, near the Mongolian border. “People would look at us like, “What the hell is going on?’” 

THE GOOD SHEPHERD

Which is similar to the reaction to that eye-opening Jason Bourne trailer, and the fact Damon, at 45, has the most impressive physique of his 20-year career as a leading man.

The fight scene was shot on Tenerife, in the Canary Islands, on the first day of filming.

Damon and Walsh had two weeks back in L.A. to get him ready for it.

They no longer needed to train for four hours a day, but the fat-stripping workouts were nonetheless brutal. Instead of sprinting through the streets, they did conditioning work on VersaClimber machines at Rise Nation. (Walsh posted the video below on Instagram of one of their workouts—12 100-foot climbs, with a minute of rest in between.) 

A video posted by Jason Walsh (@risemovement) on

Their strength work, as before, included a lot of single-leg exercises and high-volume pullups.

“He loves challenges,” Walsh says. “We got to the point where we were doing 100 pullups two or three times a week. We’d see how many sets it takes to get 100. Once you lose some of that excess weight, pullups get a lot easier. He was doing 30-some pullups per set.”

Related: How to Do 20 Perfect Pullups

Also notable is what they weren’t doing, like barbell back squats and heavy deadlifts from the floor—exercises that were considered indispensable for both strength and mass-building when Walsh started as a strength coach two decades ago.

While those are undeniably effective exercises, Walsh now sees them as falling on the wrong side of the risk-reward continuum. 

“You have to be smart with the type of people we work with,” he says. “My biggest worry was him breaking. The star of a $100 million movie? That’s a lot of pressure.”

The pressure was tripled this time around: “Keeping him injury free for two straight years, doing action films, was the biggest accomplishment.”

And that gives this Hollywood story a happy ending, even if it’s not a part of the plot the Bourne audience will ever see or know about. 

Lou Schuler is an award-winning journalist and contributing editor to Men’s Health. Check out his new book Strong: Nine Workout Programs for Women to Burn Fat, Boost Metabolism, and Build Strength for Life, with coauthor Alwyn Cosgrove.

This article originally appeared on MensHealth.com.