On his final evening as a New York Met, hours before a seismic shift in franchise history, Carlos Beltran gathered with more than two dozen teammates and coaches inside a tiny Cincinnati steakhouse. Members of the group idolized Beltran. They considered him a mentor, a confidante, and, at 34, still one of the finest players in the game. And they understood their time with him was drawing short.

The group dined at Jeff Ruby’s Steakhouse near the corner of 7th and Walnut in the Queen City on July 26, 2011. Before Beltran picked up the check, one of those friends, Jose Reyes, joked that this dinner represented Beltran’s goodbye. He must have known he was being traded. Beltran told them all he knew nothing.

About 2,400 miles away, inside a house he shared with a host family in the Silicon Valley, Zack Wheeler slept that night without a worry about his future. Two weeks prior, he heard he might be traded for Reyes. When those whispers subsided, he believed his place in San Francisco’s organization was secure. The next day, he was scheduled to start for Class-A San Jose.

The two players — the All-Star and the prospect — were on the verge of being linked forever in the minds of Mets fans. Inside his Citi Field office, four levels above the diamond, general manager Sandy Alderson spent that night fortifying the most momentous maneuver of his tenure in Flushing.

“When you’re moving a guy of Beltran’s status,” said assistant general manager John Ricco, “those deals don’t happen with a franchise every year.”

Ten months later, Wheeler has established himself as one of finest prospects in the Mets system. He carried an 1.88 ERA through nine starts with Double-A Binghamton. He and Triple-A right-hander Matt Harvey figure to headline the team’s rotation in the near-future.

Tonight Beltran returns to Citi Field for the first time in an opposing uniform. He plays for St. Louis now, and leads the National League with 15 homers, entering last night’s action. It is unclear how fans will receive him. But his place in franchise history is secure. Under Omar Minaya’s regime, Beltran formed a cornerstone of the team’s foundation. Under Alderson’s regime, Beltran served as a commodity that could be swapped for a future pillar.

“I’ve been in a front office for at least 20 years, being a part of trades,” said J.P. Ricciardi, a special assistant to Alderson. “And I’ve never been a part of a trade like this, in all my life. We had so many teams that were interested in Beltran.”

The Star-Ledger spoke with more than a dozen baseball officials in an effort to reconstruct the complicated circumstances behind this trade. Some requested anonymity in order to speak freely about the situation.

As Beltran’s availability last summer shifted from open secret to public knowledge, his popularity around baseball spiked. One team official suggested at least 10 clubs expressed interest. Alderson heard from fringe contenders like Cleveland and Pittsburgh, division rivals like Atlanta and Philadelphia, American League clubs with potent lineups like Boston and Texas.

And then there were the Giants, the defending champions, a pitching-heavy club desperate to capitalize on an opportunity to repeat.

In July, the Mets’ scouting department fanned out across the country to observe the players they wanted. They consulted their internal assessments of other organization’s farm systems to settle on targets. Potential deals bubbled to the surface, then faded into the background.

“We were looking for the best player we could get,” Alderson said. “And then maybe another player, another good player.”

Alderson negotiated through this morass while facing a variety of restrictions. Houston dangled a pair of outfielders who lowered Beltran’s market value. A clause in Beltran’s $119 million contract also precluded any clubs from recouping draft-pick compensation for his departure in free agency. And Alderson needed to loop Beltran’s agent Scott Boras into discussions, as a no-trade clause allowed Beltran to dictate some of the process.

For at least two weeks, Alderson operated inside a maelstrom of conversations with his lieutenants, his scouts, opposing executives and Boras. He sifted through the give and take of negotiations, the banter, the bluffing, the constant search for better value.

The flurry culminated inside his office at Citi Field on July 27, 2011, where he and Giants general manager Brian Sabean finalized the swap: Beltran for Wheeler. A day later, Beltran officially signed his no-trade clause and the commissioner’s office approved the Mets’ shipping about $4 million westward.

“To get Zack Wheeler,” said one rival executive, “I thought Sandy did a wonderful job.”

RISING MARKET PRICE

Brian Sabean considers himself “old-school to a fault.” He’s been the general manager with San Francisco since 1996, and he dislikes wasting his contemporaries’ time. He often sends his assistants on what he calls “fact-finding missions,” to discern another team’s interest in a deal.

“On that first call,” Sabean said, “it shouldn’t be a feeling-out session. You should have some relative intelligence so you can get something done on that call.”

So earlier in the summer of 2011, Sabean recalled, when Giants special adviser Paul Turco ran into Ricciardi, a conversation developed. Ricciardi learned the Giants might be interested in Beltran. Turco learned the Mets desired high-end talent in return. Both reported the information to their superiors, part of the standard operating procedure leading up the July 31 trading deadline.

That month, Beltran became one of the most sought-after hitters in baseball by compiling a .864 on-base plus slugging percentage in the season’s first three months. That outcome once appeared so unlikely.

Tumult colored his seven years as a Met, the brilliant moments on the field often overshadowed by a series of public tussles with the organization. The Mets were upset by Beltran’s decision to have arthroscopic knee surgery in January 2010, and later when he skipped a voluntary team trip to Walter Reed Army Medical Center in the nation’s capital that summer.

After missing the first half of 2010, Beltran often looked lost in the field. Arthritis embedded inside his knees. He entered 2011 still owed $18.5 million. As the season began, Beltran agreed to exit center, his home for 16 professional seasons.

Yet Beltran rebounded as the season began, en route to his sixth trip to the All-Star Game. By late June, as interest accumulated, the Mets decided a trade was necessary. At least two weeks before the deal, Alderson explained the situation to manager Terry Collins. “I knew that by July 31, he was going to be gone,” Collins said.

Months in advance, Beltran prepared for the same outcome. That offseason, Boras spoke with him about the likelihood of a trade. During the season, Boras sent Beltran booklets on the other teams, so Beltran was kept abreast of each club’s situation.

Together, they narrowed the available cities. In that way, the player wielded power. “We have to have a fit with the team,” Boras said.

“Scott was very cooperative,” Alderson said. “But obviously he’s got the interest of his client in mind. I think in those kind of situations, you want to have just enough communication, but not too much.”

FINDING THE SUITOR

Still, Alderson winnowed the number of buyers. Pittsburgh learned Beltran did not consider them a viable contender, one league official said. The Indians discussed the preliminary parameters of a deal with the Mets, but learned Beltran preferred to remain in the National League, according to another league official.

“These guys don’t necessarily want to change leagues,” a third official said.

Here, serendipity aided the Mets. Across the country, the Giants entered the market for a power hitter. A catastrophic leg injury had felled slugging catcher Buster Posey early in the season. Their offense stagnated. So Sabean dialed Alderson.

“That team, and every team, has an expiration date,” Sabean said. “We really wanted to get back to the playoffs, even though that we were behind the 8-ball, as far as the roster getting depleted. It’s one of those things: You owe it to the fans. You owe it to the organization.”

After the All-Star break in the second week of July, the Mets settled on the teams with what Alderson termed “legitimate interest.” Alderson dealt with the opposing clubs. Ricco operated as his safety net, reminding him about details like shaping a public-relations strategy for the move.

Ricciardi lives in Worcester, Mass. At times, he monitored Red Sox minor-leaguers. Later in the process, he helped coordinate communications between the New York office and the organization’s eyes in the field. If Alderson wanted a scout on the phone, Ricciardi made the call.

The Mets deployed scout Roy Smith to track the San Jose Giants, San Francisco’s Class-A affiliate, and observe both Wheeler and Gary Brown, a five-tools outfielder. After Smith filed reports on Wheeler, Ricciardi also watched video from his Citi Field office. “I saw a good young arm,” Ricciardi explained, “just like Roy said.”

The two sides appeared a sublime fit. Beltran would approve a deal to the World Series champions. Wheeler, the No. 6 overall pick in the 2009 draft, met the Mets’ criteria. But details still needed to be massaged. The Giants needed to commit to giving up a piece like Wheeler, and have their ownership approve budget increase brought on by Beltran’s salary.

At one point, Mets officials recalled, as the swap appeared close to completion, negotiations entered a holding pattern for a few days. Sabean did not specifically recall a moratorium, but indicated it was possible. Some within the Mets front office, reading the tea leaves, saw the Giants at their limit: Wheeler is the best you can get from us.

It’s Alderson’s job, of course, to do better. He stayed on the phones.

Some Mets officials believed Philadelphia locked in on Houston outfielder Hunter Pence, who was under team control through 2012. Atlanta did not want to part with its top pitching prospects. The Braves later traded for Astros outfielder Michael Bourn; the Phillies got Pence.

As the Mets opened a series in Cincinnati on Monday, July 25, Alderson remained in talks with the Rangers and the Red Sox. Though Alderson knew Beltran didn’t want an A.L. destination, he hoped “their reputation and cache as strong teams” might sway Beltran to budge from his stance.

Neither club dangled a single prospect as tantalizing as Wheeler, Mets officials said. Still, they researched the situation. At one point, Roy Smith transferred to inspect the Rangers farm. The Mets discussed Texas players like pitchers Joe Wieland (Double A), Robbie Ross (Double A) and Cody Buckel (Class A), plus Class-A second baseman Rougned Odor. Similar conversations occurred with Boston.

“There were a lot of names bandied about,” one team official said. “It just didn’t come through.”

From the beginning, the Mets targeted high-quality talent, what vice president of scouting and player development Paul DePodesta called “a guy who we thought had the chance to make the most impact.” That Tuesday, the Giants reappeared on the radar. Wheeler was in play.

As negotiations became serious, Sabean counseled often with Dick Tidrow, his vice president of player personnel and “our pitching guru.” Earlier that month, the former Yankees pitcher helped Wheeler correct a mechanical flaw that aided his control. The Giants built their World Series club through homegrown pitching. They trusted they could “find another Wheeler,” Sabean said, “or develop another Wheeler.” It was, he added, “a necessary evil.”

The two clubs entered the final stages of negotiations that night. After reaching an initial agreement between the teams, Alderson called Boras, who negotiated a separate deal to waive Beltran’s no-trade clause. Boras ensured Beltran’s transportation and living situation in the Bay Area was covered. The next morning, all parties tended to the paperwork. It wouldn’t become official until a day later.

After the deal was completed, Alderson walked into Ricciardi’s office.

“It’s done,” Alderson said.

THE HUMAN ELEMENT

Later that evening, about an hour before first pitch at Great American Ball Park, Beltran slipped into the visitors’ clubhouse to say his goodbyes. On his way out, headed to meet his new teammates on the road in Philadelphia, he bumped into John Ricco.

Ricco considered himself one of the last links to Minaya’s front office, the group that Beltran coined the “New Mets.” In the subsequent years, those lofty heights appeared close enough to touch, yet still out of the franchise’s reach. That day, Ricco thanked Beltran for all he gave in his time as a Met.

“There was a lot that happened over the years,” Ricco said. “And we went through a lot of highs and lows.” He added, “A guy comes in, signs as a free agent, gives us six-and-a-half years of his prime. That’s part of a trade that sometimes gets lost, that there is a human element. And I wanted to thank him for that.”

DELAYED RETURNS

Exactly 10 months after the trade, Sandy Alderson stood outside the Mets’ clubhouse at Citi Field. A reporter asked if he was pleased how the deal worked out. Alderson rolled his eyes, flashed a cockeyed grin and walked away.

The verdict remains years away, and relies upon a Double-A pitcher who turned 22 on Wednesday. Wheeler stands 6-4 and tips the scales at 185 pounds. His fastball command can be spotty, but his velocity touches the upper-90s. His offspeed offerings can be cruel. Before the season, Baseball Prospects rated him the No. 30 prospect in the game; Baseball America rated him No. 35.

On April 13, Mets minor-league field coordinator Dick Scott trekked to Hadlock Field in Portland, Maine. There he watched Wheeler torture the Portland Sea Dogs, fanning nine, walking none and allowing one run in six innings. His slider was “unhittable,” Scott said.

“When you view an outing like that,” he added, “it’s like, ‘Yeah, there it is.’ ”

Earlier this month, minor-league pitching coordinator Ron Romanick helped Wheeler refine the grip of his developing changeup. Wheeler estimated he threw the pitch 11 times during an eight-inning gem May 23. With Ricciardi in attendance, Wheeler struck out seven and allowed just two hits.

Of course, his status as a front-line prospect is always one tweaked elbow or sore shoulder away from a free fall. One rival talent evaluator who scouted Wheeler in high school expressed alarm about his slender frame. “Everything was front-line stuff,” the executive said. “My only concern: He was really thin. Would he stay durable?”

Time will tell. So much rides on Wheeler’s right arm, even if Mets officials believe their thinking behind the trade was sound. For now, the person least moved by the trade’s magnitude is the one most critical to how the trade is remembered.

“It’s baseball,” Wheeler said. “Trades are going to be made.”

Wheeler paused for a moment. The clubhouse at NYSEG Field was mostly empty. A teammate snacked on a Subway sandwich. An orange loofah hung from Wheeler’s locker. All the marks of minor-league still surrounded him, even as his connection to the future of major-league club became apparent. He considered his link to Carlos Beltran, one of the finest players in the history of Wheeler’s organization.

“I mean, it’s cool, yeah?”

Andy McCullough: amccullough@starledger.com; twitter.com/McCulloughSL