Scott Olson/Getty Images Democratic presidential candidates Sen. Bernie Sanders and former Secretary of State Hillary Clinton are rehashing what happened when a 2007 comprehensive immigration reform bill failed in the Senate.

As they fight for the Latino vote in Nevada and elsewhere, the Clinton and Sanders campaigns are sparring over an immigration reform vote that took place nine years ago.

To hear former Secretary of State and New York Sen. Hillary Clinton tell it, the matter is uncomplicated: She and then-Sen. Barack Obama supported the bill, while Sen. Bernie Sanders (I-Vt.) did not.

That is true of the final vote for the 2007 bill led by then-Sen. Ted Kennedy (D-Mass.), which would have allowed undocumented immigrants to gain legal status, created a temporary worker program and strengthened border security and enforcement against employers who hired unauthorized workers.

"I think Ted Kennedy had a very clear idea about what needed to be done," Clinton said at the most recent Democratic debate. "And I was proud to stand with him and support it."

Along the way, though, she and Obama didn't always stand with Kennedy, and how the legislation died is more complicated than just the final vote. The bill began its tortured march toward death when most Democrats -- including Clinton, Obama and Sanders -- went against Kennedy and supported an amendment that changed the legislation's guest-worker provisions.

The addition was referred to at the time as what's known on the Hill as a "poison pill" -- an unpalatable provision tacked onto a bill that is intended to kill it. The amendment Obama, Clinton and Sanders succeeded in adding threatened the bill's Republican and business support; Kennedy warned at the time that a vote for it would kill immigration reform.

It's not insignificant that Sanders opposed the 2007 immigration bill and Clinton supported it. Still, her frequent mentions of his vote, without mentioning her own role in the poison pill amendment, are a diversion, the Sanders campaign argued.

"The Hillary campaign keeps trying to divert attention from their non-existent plan and keeps pointing to 2007 when she in fact voted for the poison pill," said Arturo Carmona, national deputy political director for the Sanders campaign. "It's totally hypocritical."

The Clinton campaign argued that the final vote, not the amendments, is what counts.

“The difference between Hillary Clinton and Bernie Sanders is that Hillary Clinton voted for Senator Kennedy’s immigration reform bill in 2007 and Senator Sanders voted against it," spokeswoman Xochitl Hinojosa said in an email.

It's impossible to say whether the amendment truly killed the legislation -- given heavy GOP opposition to the entire bill, it's possible that it would have died regardless of the measure, which was sponsored by Democrat Byron Dorgan of North Dakota. Supporters of the amendment have said their goal was to improve the bill, not to kill its chances.

But supporters of the bill certainly thought at the time that the Dorgan amendment was a damaging one. Then-Sen. Jon Kyl (R-Ariz.), who was part of the immigration reform negotiations, knocked fellow Republican Jim DeMint in 2007 for voting "for the amendment to kill the bill," calling it "a poison pill."

After hearing that Obama would support the amendment, one lobbyist quipped while watching it on C-SPAN, "'Presidential candidate kills immigration bill' -- there's a headline for you." That comment from lobbyist Craig Silvertooth, who was working with the pro-reform and business-allied Essential Worker Immigration Coalition, was captured in the documentary "Last Best Chance."

Not all supporters agree on that point. America's Voice Director Frank Sharry, a longtime advocate also involved in the 2007 effort, said the idea that Obama and others wanted to sink the bill so they could use it politically was a "meme [the right] seized on for years to try to cover up for their own inability to muster support for a conservative Bush WH-drafted version of comprehensive reform."

Sharry said advocates "gave a green light to" the vote as a tactical move: Democrats would approve the amendment, and then later agree to drop it in exchange for also dropping another amendment they opposed.

"The ship finally went down, but not because of the Dorgan amendment, but because a conservative bill couldn't attract enough R votes," Sharry said in an email.

Sanders has consistently defended his vote against the bill, even as he seeks to bolster his pro-immigrant credentials. He defended the vote at last week's Democratic debate, after Clinton talked up her support for the 2007 immigration reform effort.

"I loved Ted Kennedy," Sanders replied. "But on this issue, when you have one of the large Latino organizations in America saying vote no, and you have the AFL-CIO saying vote no, and you have leading progressive Democrats, in fact, voting no, I don’t apologize for that vote."

PHOTO GALLERY Where Democratic Candidates Stand On Immigration