Sen. Joe Manchin (D-W.Va.), along side Sen. Pat Toomey (R-Penn.), unveiled a bipartisan deal to expand background checks on all commercial sales of guns on Wednesday. (The Washington Post)

Before Wednesday, Sen. Joe Manchin III was not known for crafting complicated legislation.

He was known for shooting it.

That is not a metaphor. In 2010, Manchin, a Democrat from West Virginia, filmed a campaign ad that highlighted his outsider politics, his distance from President Obama, and his love of firearms, all in one memorable act of man-on-bill violence. He used a hunting rifle to blast a hole in a copy of Obama’s favored “cap and trade” climate proposal.

On Wednesday, Manchin was at a Senate podium, playing a vastly different role. In a Senate where dealmaking is a nearly dead art, this old outsider had cut a deal that could pave the way for a major expansion of U.S. gun-control laws.

For Manchin, that agreement was the payoff from months of relationship-building with Republicans, including nights of pizza and beer on a senator-stuffed boat called the Black Tie. The final deal was worked out over the past week, and concluded late Tuesday with a huddle at a rooftop birthday party for TV host Joe Scarborough.

There, Sen. Charles E. Schumer (D-N.Y.) agreed to support the proposal — but to skip the news conference so his enemies would not become the bill’s enemies.

The big news instead was delivered by Manchin, in his third year in the Senate, serving notice that Washington had underestimated his ambition and his flexibility.

“This is common sense,” he said. “This is gun sense.”

Manchin’s deal was struck with two Republican senators, Mark Kirk (Ill.) and Patrick J. Toomey (Pa.). Its most important feature is a proposal to expand background checks for gun buyers, to cover transactions at gun shows and Internet sales.

The deal does not go as far as Obama wanted, however. It exempts sales between private citizens, where no business or advertising is involved.

But it will serve as a starting point for a long Senate debate. Wednesday’s deal was made because of Toomey, who got involved last Wednesday and holds an “A” rating from the National Rifle Association, just like Manchin. (Schumer and Kirk’s involvement was not much of a breakthrough, as both received an “F.”)

“What matters to me is doing the right thing,” Toomey said at Wednesday’s news conference when a reporter asked if his “A” might be in jeopardy. “I think this is the right thing.” The NRA said Tuesday that it opposes Toomey and Manchin’s deal.

Manchin, 65, comes from small-town Farmington, W.Va., where he progressed from a BB gun to a .22 caliber rifle to bigger guns used to hunt deer. He also progressed through state politics, starting as a member of the West Virginia House of Delegates in the early 1980s and eventually served two terms as governor.

In that office, he is perhaps best known for bridging a long-running divide between coal companies and miners. After one mine disaster, Manchin helped lead a fight to require more safety precautions underground. Miners and mine owners have supported him in his Senate races.

Until recently, Manchin appeared to be one of the Senate’s most unlikely leaders. In 2010, he won the seat that the late Sen. Robert C. Byrd (D) had held for 51 years. He became a symbol of a blue party in a reddening state, and faced two elections in two years.

Back then, Manchin’s survival strategy was to say little, and portray himself as the Senate’s least Democratic Democrat.

After winning reelection in November, though, he won’t have to run again until 2018. He now has time for ambition, and — after December’s mass shooting at a school in Newtown, Conn. — he chose to direct it toward changing gun laws.

“I find myself in a position now, coming from a gun culture . . . of credibility,” Manchin said in an interview in his office on Wednesday. “If I tell a person, ‘Listen, they’re not going to take my guns. And if you believe that I’m going sign on to a piece of legislation that would let them take your guns, you’re sadly mistaken.’ ”

The first time Manchin tried to lead, it didn’t go so well.

“I don’t know anyone in the sporting and hunting arena who goes out with an assault rifle,” he said on Scarborough’s MSNBC show, “Morning Joe,” a few days after the Newtown massacre. “I don’t know anyone who needs 30 rounds in the clip to go hunting.”

That was read as support for two ideas that the gun lobby fiercely opposes: bans on military-style assault weapons and high-capacity ammunition magazines. Gun groups got mad. Manchin seemed to back off, praising the NRA and saying he didn’t support “a ban on anything.”

After that, advocates on both sides didn’t trust him much. But on Capitol Hill, powerful Democrats started to look at Manchin as a potential backroom leader.

Senate Majority Leader Harry M. Reid (D-Nev.) said in a statement Wednesday that Manchin “drove this process by building bridges across the aisle while staying true to his principles. He provided a model for all of us for how to get things done, by rolling up his sleeves to work through tough issues and find common ground.”

Earlier in the week, Schumer said that Manchin was “a guy who’s got principles, but he’s practical. And that’s what’s happening on guns.”

And he had friends. Manchin and Kirk had made a practice of inviting colleagues out on the Potomac River in a boat that Manchin owns a small stake in. Their trips from National Harbor sometimes included 10 or more senators, and a conversation that covered a variety of subjects, including guns.

“I’m doing everything I can to build relationships,” Manchin said Wednesday. “The cheapest thing you can do is feed people.”

The beer also helps.

“What happens on the Black Tie stays on the Black Tie,” Kirk told reporters Wednesday, in his most most expansive exchange with reporters since he had a stroke in January 2012. “Sometimes alcoholic beverages may be served and ties might [get] loosened. I’d say that Joe has lots of the credit for this.”

This spring, Manchin began trying to find a friend who would agree with him about strengthening gun laws. He worked with Sen. Tom Coburn (R-Okla.), but they couldn’t reach consensus.

When Coburn backed out, Toomey came in. Their deal on Wednesday provides some elements that gun-rights groups will like, including a provision that allows gun owners on road trips to carry their weapons through states where the firearms are not legal.

“So far, I’m going to give him the benefit of the doubt,” said Gary Bailey, president of the West Virginia State Rifle and Pistol Association, who spoke with Manchin about the deal on Wednesday morning. He said Manchin had told them he was the right person to broker a fair deal: “He said, you know, ‘Something has to be done. So, who’s going to do it?’ ”

The deal also won approval from Schumer, who is on the opposite side of the country’s long battle over gun laws. On Tuesday afternoon, as the Senate broke for lunch, Manchin and Schumer huddled in the well of the Senate chamber, even as aides turned off the lights. Later that night, the two met at Scarborough’s birthday party, held across the street from the Capitol.

Senate aides said Manchin had a delicate request: Schumer, a love-him-or-hate-him icon of the left, should stay away. Schumer said yes. For Toomey, it was better politics to be seen with just Manchin.

“We have an agreement,” Manchin said when the two appeared alone Wednesday morning. “Pat and I have an agreement.”

Discuss this topic and other political issues in the politics discussion forums.