Jim Fregosi Jr. signed Ryan Madson to his first pro contract with Philadelphia in 1998. Then 15 years later, he gave the ex-Phillies closer another lifeline.

Madson, officially announced as a member of the A’s bullpen Friday along with John Axford, was out of baseball for three years because of elbow trouble, and he retired in 2014.

That’s when Fregosi called and asked Madson to work with a teenager in Temecula (Riverside County) named Johnny Morrell. Madson, also living in the area with his wife and five kids, was coming to grips with the end of his career and looking for chances to teach pitching.


“That time was difficult,” Madson said. “Not being able to do what I wanted to do, it all taken away a little early, in my opinion.”

As the lessons went along, a funny thing happened: Madson’s arm felt great, and his stuff was as good as ever.

“We started in June and by August, Johnny and his dad were saying, ‘Hey, are you sure you don’t want to play again?’ I was 99 percent sure I was done,” Madson said.

Morrell reported back to Fregosi that Madson was throwing the ball well. “So I called Ryan and said, ‘How are you doing?’ and he said, ‘Really good,’” Fregosi said this week at the winter meetings. “I told him, ‘If you can get it to the plate, basically, we’ll sign you to a minor-league deal.’ … He just needed a break to get back in the game.”

Come springtime, though, Kansas City manager Ned Yost was skeptical. “I’m being really, really honest. When I first got to spring training and I looked at our roster, I’m like, ‘Ryan Madson? He hasn’t pitched in three years. What are we doing here?’” Yost said this week in Nashville. “Then I went out and watched him … I said, ‘Man, that’s pretty good stuff.’”

Because of the long layoff, Kansas City planned to send Madson to Triple-A for a month. He had an option to leave, however, if another team gave him a big-league job, and such an offer materialized.

“I went home that day thinking, ‘I’m going to let him go, I’m going to let him go,’ and I went to bed and I woke up in the middle of the night telling myself, ‘You can’t let this guy go. You just can’t,’” Yost said.

Kansas City kept Madson, and he helped the Royals to go all the way. “He just never missed a beat from the first day to the last day of the season,” Yost said. “Just really resurrected his career with great stuff.”

“Just a perfect situation to be back in baseball,” Madson said. “I couldn’t have drawn it up any better.”

This winter, Madson said, the A’s were aggressive out of the gate. He had good feelings about them and liked the idea of pitching at the Coliseum. He also found the A’s to be a “scrappy, good team” after repeated benches-clearing incidents against the Royals. “We had some crazy moments over there, obviously,” he said.

What an arc: From out of the game to a championship and now a $22 million deal with the A’s, who will use Madson as their primary setup man, with Axford also in a setup role behind closer Sean Doolittle.

“What Ryan’s done in mind-boggling,” Fregosi said. “I’m so happy for him — and happy for us, too: he helped us to the World Series.”

And for that, Madson goes back to Johnny Morrell and their lessons for his turnaround. “It’s a story I will tell the rest of my life,” he said.

Susan Slusser is a San Francisco Chronicle staff writer. E-mail: sslusseer@sfchronicle.com Twitter: @susanslusser