Democrat David Weprin faces a surprisingly close race. (Ken Goldfield/AP Photo)

And much — though not all — of that has to do with Weprin’s struggles on the campaign trail.

Last week, Weprin misstated the national debt by over ten trillion dollars. He enraged local officials by canceling on a debate at the last minute, citing weather concerns. And, when asked if he would endorse President Obama in 2012, he gave a convoluted answer, saying “I will probably not refuse to endorse him” — not exactly music to the ears of Democratic base voters.

So why did Democrats pick a candidate who doesn’t seem to be ready for primetime?

It mostly comes down to redistricting.

As we’ve written before, New York is losing two seats due to population growth over the last decade that lagged the national party and each party is expected to sacrifice one of their own districts. Democrats are likely to choose the 9th, given that its representative will have the least seniority in the state.

Party insiders say that Democrats demanded any potential candidate for the special election pledge not challenge another incumbent in 2012 in the event the 9th district was eliminated. Weprin was chosen in part by Rep. Joe Crowley, who in addition to representing a neighboring district, leads the Queens Democratic Party.

Most politicians with bright futures in city or federal politics didn’t think it was worth dropping their current jobs for a few months in the House, with little-to-no chance to win again.

Unlike the special election earlier this year in upstate New York where Democrats searched for a strong candidate and landed on now-Rep. Kathy Hochul, here their criteria for running virtually ensured the strongest candidate wouldn’t step forward.

Enter Weprin. Though he was elected to the state Assembly in 2010, he had run the previous year for city comptroller and finished dead last in the Democratic primary. (Wepring does come from a family of city politicians — his father Saul was speaker of the state assembly, and his brother Mark holds his old city council seat.)

“It’s only a mistake if he loses,” said Doug Muzzio, a political science professor at Baruch College. “If he wins, it wasn’t a mistake. I presume that other candidates thought it wasn’t worth it to hold on to that seat and then be redistricted out.”

And while the district is undeniably Democratic, it is conservative by New York City standards. The Cook Partisan Voting Index rates it only D +5, meaning that it performed only five points more Democratic than the average in the 2008 election. (In the 2008 election, Obama won the 9th with only 55 percent of the vote, a far smaller margin of victory than in neighboring New York City districts.)

Democrats remain confident that Weprin will win, pointing to Turner’s weak fundraising and their own internal polling. Turner has made his own gaffes; he criticized health-care for Ground Zero volunteers and praised tax loopholes in a recent debate. (This isn’t a great opportunity for Republicans either.) But that we are even talking about this race has more to do with local factors than any sort of national wind blowing.