Charlie Wilson, the fun-loving Texas congressman whose 1980s campaign to rid Afghanistan of Soviet influence was memorably captured in a Hollywood film that bore his name, died Wednesday. He was 76.

Wilson died of cardiopulmonary arrest at Memorial Medical Center in his hometown of Lufkin, Texas. He had collapsed earlier in the day.

Wilson was a charming, handsome rogue of a congressman who thrived in an era when the media spotlight shone less brightly on the private lives of elected officials. He packed his office ranks with young women, dubbed "Charlie's Angels." His high-flying, hard-partying ways were immortalized by actor Tom Hanks in 2007's " Charlie Wilson's War."

But that film, like the book by George Crile III that inspired it, also told the seemingly larger-than-life tale of how an obscure congressman from a rural East Texas district almost single-handedly engineered a flow of federal funds to support Afghan resistance fighters against the occupying forces of the Soviet Union during the 1980s.

That legacy grew more complicated as the Muslim freedom fighters that Wilson tirelessly championed evolved into the Taliban, which would ultimately give haven to Al Qaeda.

Wilson's friend of 45 years, Buddy Temple, said the figure presented in the film failed to replicate the man he knew.

"Charlie was a go-to guy in Congress," Temple said at a news conference in Lufkin shortly after Wilson's death Wednesday. "The whole idea that he was this playboy who never paid attention to business was just as wrong as it could be."

Said Rep. David Obey (D-Wisconsin), who served with Wilson in the House of Representatives: "Charlie was a man of courage and conviction who worked hard, loved his country, and lived life to the fullest. "

Charles Nesbitt Wilson was born June 1, 1933, in the town of Trinity, Texas. He graduated from the U.S. Naval Academy in 1956 and served a four-year term as a Navy officer. And while Wilson, a Democrat, would become known as "the liberal from Lufkin" because of his social views, he was hawkish on military matters. It would prove to be a winning combination in his moderate congressional district, where he was voted into 12 terms in the House, from 1973 to 1996.

Before that, he cut his teeth on Texas politics, holding office in the state House and Senate, where he unabashedly fought for a progressive agenda and unapologetically lived an outsized personal life, acquiring a nickname that would follow him to Washington: "Good Time Charlie."

In the U.S. House, Wilson found his true calling: opposing what he saw as the creeping forces of Communism worldwide. He became a staunch supporter of the right-wing government in Nicaragua, threatening at one point to scuttle President Carter's Panama Canal Treaty over the administration's Nicaraguan policy.

But Afghanistan became his passion after the Soviet Union invaded the country in 1979. During a fact-finding visit to Pakistan in 1982 -- and at the urging of a wealthy Houston benefactor, Joanne Herring -- he embraced the cause of the Muslim rebels he found there.

Wilson later said that he was inspired by visiting child victims of Soviet bombs in Pakistani hospitals near the Afghan border.

Using his seat on the powerful House Appropriations Defense subcommittee and taking advantage of the secrecy of the budgets for U.S. covert operations, Wilson -- later with the assistance of the Central Intelligence Agency -- funneled billions of dollars in weapons to the resistance. They included shoulder-fired Stinger missiles, which were used to shoot down Soviet helicopters.

The Soviet Union ultimately abandoned Afghanistan in 1989, and Wilson was decorated by the CIA.

His personal life, at times, threatened to derail his anti-Communist efforts. In 1983, a young attorney with the Justice Department, Rudolph Giuliani, said he was investigating whether Wilson had used cocaine three years earlier while partying in a Las Vegas hot tub with two showgirls. The department ended up not pursuing the case. That same year, Wilson was cited for leaving the scene of an accident after striking another car on the Memorial Bridge outside Washington.

Wilson told his biographer, Crile, that the showgirls had indeed snorted cocaine from their fingernails that night, but he stopped short of saying he joined them.

"The feds spent a million bucks trying to figure out whether, when those fingernails passed under my nose, did I inhale or exhale," Wilson said, "and I ain't telling."

But while he was taking care of the mujahedin in Afghanistan, he was also looking after his East Texas district, sending earmarks and backing the region's timber and oil interests. He repeatedly won reelection and voters seemed to take no issue with his indiscretions.

"If my constituents didn't forgive sloppiness and a certain amount of eccentricity, I wouldn't be here in the first place," Wilson said in the early 1990s.

Wilson retired from the House in 1996 and became a lobbyist. In 1999 he married Barbara Albertstadt, a former ballerina. A previous marriage had ended in divorce.

He moved back to Lufkin and underwent a heart transplant in 2007. Earlier this year, he helped dedicate the new Charlie Wilson Chair for Pakistan Studies at the University of Texas.