Peter A. Magowan, the charismatic Safeway supermarket magnate and San Francisco Giants owner and executive who fought off relocation of the team and spearheaded construction of their waterfront ballpark, died Sunday afternoon at his home in Pacific Heights.

Magowan had been ill for several years, undergoing surgeries for prostate and liver cancer, and had recently gone into hospice care. He died surrounded by family and friends, according to his wife, Debby Magowan. He was 76.

Magowan was Safeway’s CEO from 1979 until April 1993, when he began a 15-year tenure as managing general partner of the Giants.

He hired the executives who built four World Series teams that garnered three championships, in 2010, ’12 and ’14, and led the franchise and its owners to significant financial success.

Magowan also OKd the signing of All-Star outfielder Barry Bonds after the 1992 season, a shocking entry into baseball’s free-agent marketplace by what had been a stingy franchise.

“Peter was a rare combination in life of a close friend and mentor,” said Larry Baer, president and CEO of the Giants. “We carried on that relationship for three decades. When you really got to know Peter you saw that he had a heart of gold.”

A prep school kid with a Stanford pedigree, Magowan brought a patrician elegance to Major League Baseball when his management group came to Candlestick Park in 1993. As opposed to tradition, which was for ownership to hide behind glass in a private suite at the ballpark, he sat with the fans in his business suit.

Magowan brought a stylish flair to the ballpark, where he was for most home games, and he was able to do what others had failed: to get a ballpark built in downtown San Francisco — it opened at Third and King streets in 2000 — and do it without taxpayer money.

“He loved sitting in the stands interacting with fans,” said Baer, who often sat with him. “You had to twist his arm with a compelling business reason to get him up into the fancy suites.”

On Feb. 9, Magowan will be added to the Giants Wall of Fame. He had prepared a speech, which he hoped to live long enough to deliver, for the event.

“I’m often given undue credit for keeping the team from going to Florida and for building this ballpark,” he wrote. “This is a very incorrect way of looking at our accomplishment as the ballpark would not have been built without the contribution of our partners.”

His tenure was not without controversy.

Magowan was criticized in the landmark Mitchell Report — written by former U.S. Sen. George Mitchell after an investigation of the use of performance-enhancing drugs in baseball that was commissioned by baseball’s commissioner, Bud Selig — for turning a blind eye toward the use of such drugs by Giants players.

Years later, Magowan expressed regret for not doing more.

Nevertheless, Giants lovers will remember Magowan as one of the civic leaders who helped prevent the team from moving to St. Petersburg, Fla., in 1992. Owner Bob Lurie had reached a sale agreement with a group that planned to move the Giants, who had been losing money.

In truth, the National League rejected the sale and suggested to Lurie that he find local owners who would run the team in San Francisco. Magowan and Baer organized a Who’s Who of Bay Area business elite into a partnership that bought the club from Lurie for $100 million.

The group included Charles B. Johnson, then a principal in the company now known as Franklin Templeton Investments. Johnson is the Giants’ largest shareholder today.

“Peter Magowan did save baseball for San Francisco,” Bud Selig, then the commissioner of baseball, said in 2008, when Magowan stepped down as managing general partner.

“He should get credit for that. That’s a fact. He got a beautiful ballpark built. When you look back at what he’s done in San Francisco, a town he loves, those are the two overriding things he did.”

After multiple failed attempts to build a publicly financed stadium to replace the aging, freezing Candlestick Park, the Giants under Magowan built what is called Oracle Park. They used private funding, which is common now but at the time annoyed sports franchise owners who sneered at the precedent.

The Giants broke ground on their $350 million waterfront ballpark in 1997. Before the first game there in 2000, Magowan and Baer threw out the ceremonial first pitches.

The team and ballpark now are believed to be worth well over $2 billion.

“Look at the success the Giants had in his regime,” said Bruce Bochy, who has managed them on the field since 2007. “We’re one of the most successful franchises in baseball. It’s very impressive what happened here since Peter took over.”

“I think we had a lot of influence,” Magowan said upon his election to the Bay Area Sports Hall of Fame in 2016.

For Magowan, the Giants were a labor of love as well as profit.

Peter Alden Magowan was born on April 5, 1942, in Manhattan, where he grew up on East 69th Street off Park Avenue. His maternal grandfather, Charles Merrill, co-founder of the Merrill Lynch brokerage, later became the largest investor in the Safeway supermarket chain.

After the New York Giants won the National League pennant on Bobby Thomson’s home run in 1951 — the “Shot Heard Round the World” — Magowan’s father, Robert, told Peter that they would attend the first game of the World Series the next day.

In eulogizing Thomson in 2010, Magowan said, “He meant a great deal to me. Not too many people can honestly say the moment that made them the happiest in their lives occurred when they were 9 years old.”

Magowan got to know Thomson in later years, but said when he was a kid, “I’d have rather met Bobby Thomson than the president of the United States.”

Magowan’s decision to help keep the Giants in San Francisco was born of the pain he felt when the club left his hometown for San Francisco in 1958.

Through the years 1979 Elected chairman and CEO of Safeway. 1992 Led a group of investors that purchased the Giants, ensuring they would stay in San Francisco. 1992 Signed free-agent Barry Bonds to a six-year, $43.75 million contract. 1993 Left Safeway and became managing general partner of the Giants. 1995 Unveiled plans to build a privately funded ballpark in China Basin, which opened in 2000. 2008 Retired as managing general partner of the Giants at age 66.

Read More

“I was strongly influenced by what happened to the Giants in New York,” he said. “I saw them leave, and it was so difficult to understand. The Giants won the World Series in 1954, the Dodgers won it in 1955, and two years later both teams were heading to California.”

Magowan grew up a city kid, but after school at St. Bernard’s boys school, the baseball team would ride buses to Randall’s Island to practice and play. After prepping at Groton, outside Boston, he came west to attend Stanford University, where he was captain of the freshman soccer team and also played on the varsity.

He graduated in 1964, with a degree in American Literature, then went overseas to earn his master’s in politics, philosophy and economics from Oxford University. His first choice was to join the foreign service, so he entered a graduate program at the Johns Hopkins School of Advanced International Studies, but he became disillusioned and went to work for Safeway in 1968 in the Washington area, where the grocery chain had many stores.

At different levels of management he worked in Houston, Tulsa, Okla.; Phoenix; and Toronto before ending up at headquarters in Oakland. After his father relinquished the chairmanship, Peter became Safeway’s chairman and CEO in 1979.

His first marriage ended in divorce, and in 1982 he met Debby Johnston at a dinner party given by Johnston’s brother, a friend of Magowan’s, in Jacksonville, Fla.

“He was smart and charismatic and fun to be with,” said Debby Magowan. “He was a true Renaissance man. He could do everything, even cook.”

They were married in Dallas, where Johnston lived, in 1982. They bought a house in Pacific Heights, and moved just once thereafter.

In 1986, Magowan helped the grocery chain avoid a hostile takeover and complete a leveraged buyout, a process by which a company is taken private primarily with borrowed funds. The deal forced Safeway to shut about half of its stores between 1986 and 1988.

The cutbacks meant Safeway was no longer the nation’s largest food retailer, but it also allowed the company to pay down debt and focus on its most profitable core.

“We became a smaller company, but we became better managed, better operated as a result,” Magowan told The Chronicle in 2003.

Safeway went public again in the early 1990s, generating a massive payoff for its new owners.

Magowan left Safeway’s day-to-day operations to run the Giants in 1993. His first major move was signing Bonds, the son of longtime Giants outfielder Bobby Bonds, to a six-year, $43.75 million contract, then the richest ever awarded.

That annoyed the other teams, too. Bonds was the game’s best player, and the Giants reached the deal at the baseball winter meetings in Louisville, Ky., before the other teams’ owners formally approved the Giants’ sale to Magowan’s group.

Bonds spent 15 seasons with the Giants, setting the single-season and all-time home run records, a great triumph on the field. At the same time, Bonds’ suspected use of performance-enhancing drugs, which were widespread throughout baseball at the time, led to criticism of Magowan and the Giants in the Mitchell Report.

“I didn’t see what I was supposed to see, and I’m sorry for that,” Magowan told The Chronicle years later. “People say, ‘Why didn’t you know Barry was taking steroids?’ I say, ‘I don’t know. I still don’t know.’ What am I supposed to do, go in his locker and see if there’s a steroid bottle? Even if there was, would I recognize it? I didn’t think that was my job?”

Bonds said Sunday: “I’m extremely saddened by the passing of Peter Magowan. I will never forget our first call about the possibility of me coming home to play. He saved baseball for San Francisco and will be greatly missed.”

In 2008, a year after Magowan announced the Giants would not bring Bonds back for a 16th season, Magowan retired as managing general partner, replaced by fellow investor William H. Neukom.

Rumors abounded that the other owners pushed Magowan out because of the Mitchell Report embarrassment and a few gigantic contracts for players who fell short of expectations. But Magowan said the decision was his. He was 66 and said he wanted to spend more time with family. He retained a stake in the club and was listed as a principal owner in the 2018 media guide.

The Giants’ only World Series appearance during Magowan’s reign as managing general partner came in 2002, the disappointing seven-game loss to the then-Anaheim Angels. The Giants had led 5-0 in the seventh inning of Game 6, needing nine outs to win their first title since moving west, but lost.

Eight years later, Neukom was at the helm but Magowan was in the clubhouse after the Giants defeated the Texas Rangers to win the franchise’s first World Series since 1954.

Asked if that title eased the pain of all the years in between, Magowan said, “It does. It erases it. I don’t think a day goes by that I don’t think about the ’02 World Series. I still think a lot about ’62, to say nothing about all the other near-misses. This does knock it all away.”

After Magowan retired from Safeway and the Giants, he still went to work every day at an office downtown. He ate lunch at Sam’s and played dominoes at the Pacific-Union Club. The Magowans had season tickets to the San Francisco Opera, and attended 30 Giants games a season, always sitting behind the Giants dugout.

When Magowan wasn’t there, he was in St. Helena, deadheading roses and growing peonies “despite being told that they wouldn’t grow in this climate,” Debby Magowan said. “He relished a challenge.”

A memorial service will be private. Survivors include his wife, three brothers, five children and 13 grandchildren.

Chronicle staff writer John Shea contributed to this report.

Henry Schulman and Sam Whiting are San Francisco Chronicle staff writers. Email: hschulman@sfchronicle.com, swhiting@sfchronicle.com Twitter: @hankschulman, @SamWhitingSF