A Texas congressional candidate who favors marijuana legalization beat eight-term incumbent El Paso Rep. Silvestre Reyes Tuesday in the Democratic primary for the congressional district closest to Mexico's Ciudad Juarez.

In unofficial results, Beto O'Rourke scored 23,248 votes for 50.5 percent of the vote, clearing the 50 percent threshold needed to avoid a runoff. Reyes tallied 44.4 percent. The 2012 Democratic primary boasted more than 10,000 additional voters over 2010, sending turnout up from 9.8 percent to 14.2 percent.

"Can you all just confirm for me that this is really happening?" O'Rourke asked a crowd at his victory party after the results came in, according to the El Paso Times. "I want to thank all of you for making this possible."

Reyes was less exuberant in defeat, slamming "my opponent who deliberately ran a nasty, dirty campaign."

The race received national attention because of O'Rourke's position in support of marijuana legalization. In his second term as an El Paso city representative, O'Rourke pushed for a resolution calling for a re-examination of the drug war, which has killed tens of thousands in neighboring Mexico over the past decade. He also co-authored a book on the same subject.

The drug war is "a failure," O'Rourke told HuffPost in April, adding that marijuana is "the cornerstone of the cartel economy" and thus fuels the violence in El Paso's sister city.

Reyes, a Vietnam veteran and former border patrol officer, responded with a TV ad charging that O'Rourke was encouraging drug use among children.

This is the second high-profile Democratic primary this month where the candidates squared off over marijuana prohibition. On May 15, Ellen Rosenblum won the Oregon attorney general's office on a pledge to make enforcing marijuana laws a low priority.

In the final weeks of the Texas race, O'Rourke had somewhat downplayed his views on legalization. He said that it was a low priority for El Paso voters and not something he would pursue in Congress.

"He's backed off a lot on the talking points about the need to legalize marijuana or the impact it has on this border community," said Richard Pineda, associate director of Sam Donaldson Center at University of Texas El Paso. "I think that it's unlikely he's going to be a champion for that issue."

Local political observers dismissed the idea that pot policy had much to do with voters' ballot box decisions.

"Other, bigger issues have come into play," said Gregory Rocha, an associate professor of political science at the University of Texas-El Paso. Foremost among them, he said, was a perception that Reyes had become an entrenched, corrupt incumbent. The congressman was hit hard by allegations that he had steered $600,000 in campaign funds to himself and his family members via consulting jobs.

Those charges were pushed by the Campaign for Primary Accountability, an anti-incumbent super PAC that targeted Reyes with what it said were $245,000 in independent expenditures. Much of that money was spent on negative television ads.

"They've done the dirty work," said Rocha. "Just like what we've seen in the Republican campaign: the super PACs did the dirty work for Mitt Romney."

After O'Rourke won, the super PAC, which Reyes had criticized for accepting money from wealthy GOP donors who include Joe Ricketts, released a statement: "Rep. Reyes had all the benefits of incumbency. Beltway lobbyists showered money on their long-time friend while Washington party leaders with marquee names tried to lend him their stature. "The voters exercised their franchise and chose Beto O’Rourke," the statement continued.

Reyes, in the final days of the race, became increasingly negative in response. His campaign aired an ad highlighting O'Rourke's arrest for driving while intoxicated in the 1990s, and he made several statements claiming his opponent was a closet Republican.

Reyes "did try to put forth a pretty nasty ad of his own," said Rocha. But voters weren't buying it: "It was pretty bombastic. Pretty much on O'Rourke's character, with not much link to public policy."

This article has been updated to include the latest results.

Below, where you can find legalized medical marijuana in the United States:

PHOTO GALLERY Legal Marijuana Across The U.S.