Sen. Pat Toomey (R-Pa.). (AP)

Updated at 8:30 p.m.

Sen. Patrick Toomey's involvement in months-long negotiations over how to expand the nation's gun background check program began much sooner than this week, according to an accounting provided by staffers Thursday.

Toomey (R-Pa.) only emerged as a key player in recent days, but he first instructed his staff in March to reach out and determine how far along Sen. Joe Manchin III (D-W. Va.) was on a proposal to expand gun background checks to virtually all gun purchases. The process ended late Tuesday as Toomey and Manchin staffers hammered out the particulars of a deal over sandwiches from Taylor Gourmet — a staple for Philadelphia transplants working in Washington.

The two senators from neighboring states first met during a meeting in Manchin's office after Toomey joined the Senate in 2011. The two have worked together on issues of regional concern, including emissions standards and permitting for coal, aides said. They flew together in February to an energy conference in Pittsburgh, where they discussed ways they might be able to work together more often.

"We flew together, we talked a little bit, we just like each other," Manchin recalled in an interview Wednesday. "I like Pat, I feel comfortable with Pat. He knows that I’m conservative on fiscal matters, I might be different with him on some social matters. I’m a Democrat, he’s a Republican, but we’re both trying to represent our states best we can. And we respect each other, we’re not trying to embarrass or ‘gotcha and I’ll use this against you.’ I think he trust me and knows I’d never do that. And I trust him and know he wouldn’t do that.”

In the days after the mass shooting in Newtown, Conn., last December, Toomey instructed staffers to begin reviewing legislative proposals being pushed by Democrats at the time. As part of the process, aides said Toomey and his staff spoke with a wide array of people for and against new gun laws — Philadelphia Mayor Michael Nutter, Sen. Tom Coburn (R-Okla.), members of the Senate Judiciary Committee, representatives with the National Rifle Association and former Rep. Gabrielle Giffords (D-Ariz.), who was wounded in a 2011 assassination attempt. In recent days as the deal came together, Toomey spoke with President Obama, Vice President Biden and people from Newtown.

Other Senate staffers familiar with the talks confirmed the Toomey staff's accounting of events, some of whom said that the involvement of Giffords and her new group, Americans for Responsible Solutions, proved critical to the Manchin-Toomey talks.

A staffer with Giffords's group met with Toomey’s staffers about two weeks ago. In the behind-the-scenes meeting, the staffer realized that there was common ground between Toomey and Manchin because the Toomey staffers were open to closing the "gunshow loophole" and amenable to expanding background checks to cover Internet gun sales, according to aides familiar with the talks.

The Giffords staffer approached Manchin aides, told them of the meeting and suggested that they reach out to Toomey and all sit down together. The Giffords staffers stayed in touch with both offices, in an effort to bring the senators together on expanded background checks.

"They really ignited the fire,” a senior Senate aide familiar with the talks said of the Giffords group.

"What made the Giffords group effective is that they are in the sweet spot that is not ideologically driven, but instead fact-driven,” said the senior aide. “Their approach is to come from the middle which allows them to have credibility on both sides. There is no way a far left group will have any influence with Republicans. And a far right group won’t have any influence with Democrats.”

Over the two-week Easter recess, Toomey staffers realized their boss was open to doing something with Manchin. There had been phone calls between the two senators and activity accelerated late last week.

Early reports last Friday suggested the pair were on the verge of a deal. But the agreement wasn't finalized until Tuesday night.

That's when Manchin presented Senate Majority Leader Harry M. Reid (D-Nev.) and Sen. Charles E. Schumer (D-N.Y.) with 10 specific items Toomey wanted added to the bill. Schumer agreed to five unspecified proposals, but rejected two others — national reciprocity for state-issued concealed carry permits and a provision saying that only online gun sellers who sold at least five or more guns per month would need to conduct background checks, aides said.

Three outstanding issues remained — details of the background check program's three-day waiting period, provisions related to how a gun owner could carry a weapon across state lines and who would need to keep records of gun sales involving people who had a concealed carry permit.

By Wednesday morning, there was a deal.

The plan would extend the current background check requirement to include sales that takes place at a gun show or that are advertised in print or online. But checks will not be required for most private firearms transfers, a concession by Democrats that many gun-control advocates eagerly sought.

On Wednesday morning, Toomey told reporters that he joined the talks because "gun legislation appeared destined to reach the Senate floor."

"It became apparent that there are a number of gun control proposals that I think actually would infringe Second Amendment rights," he said. "And I will tell you categorically that nothing in our amendment prevents the ownership of guns and I wouldn’t support it if it did."

Throughout the process, Toomey kept in touch with several of the 13 Republicans in Pennsylvania's House delegation — all of whom have "A" ratings from the NRA. Toomey is a former member of the House, and his interactions with former colleagues could help compel the House to act on gun legislation.

Rep. Patrick Meehan (R-Pa.), one of several suburban Philadelphia GOP congressmen seeking to support a gun bill, said Thursday that Toomey’s involvement in the Senate negotiations will make his own work on the issue much easier.

“I think the fact that Sen. Toomey is behind it will cause people will take the time to say, ‘Hey, if a guy like Pat Toomey and hopefully Pat Meehan and [Rep. Mike Fitzpatrick (R-Pa.)] can be finding a way to support this, let me make sure I understand it,’” he said.

Sari Horwitz contributed to this report.