HARRISBURG — At least five House lawmakers — Democrats and Republicans, from Philadelphia to Pittsburgh — lost their seats Tuesday in head-turning upsets in what would usually be predictable legislative primary races.

Among those who fought down to the wire to hold on to their seats was House Speaker Sam Smith (R., Jefferson), who withstood a challenge by an anti-incumbent conservative by a whisper-thin margin.

Longtime House Transportation chairman Rep. Rick Geist (R., Blair) was not so lucky. Geist, in his 33d year as a lawmaker, was unseated by John McGinnis, a college finance professor and political unknown. McGinnis was backed by a well-funded Harrisburg interest group, Citizens' Alliance, that for the last year has targeted a number of Republicans they deem "not conservative enough" or too cozy with Democrats.

Two veteran lawmakers on the other side of the aisle, Rep. Babette Josephs (D., Phila.) and Rep. Joseph Preston (D. Allegheny), also were defeated, along with two relative newcomers from the Scranton area, Reps. Kevin Murphy and Ken Smith, both from Lackawanna County.

Even Sam Smith, the highest-ranking leader in the House and a 26-year veteran, only narrowly hung on to his seat against Cris Dush, who criticized Smith for his long tenurein office and his role in orchestrating the widely unpopular legislative pay raise in 2005.

Few saw the losses coming ahead of Tuesday and party leaders chalk them up to low turnout and district idiosyncrasies rather than any broader trends of voter dissatisfaction.

"Look at all five and each had unique circumstances," said Rep. Dave Reed (R., Indiana), chairman of the House Republican Campaign Committee. "Lawmakers have to make sure they work, even 30 years later, as hard as when they came in, because someone is always ready to take your position."

Some Capitol political observers blame the losses on a combination of antitax and anti-incumbent sentiment. But unlike 2006, when activists, angry about the pay raise, launched a high-profile, bipartisan "throw-the-bums-out" campaign that sent home 54 sitting lawmakers, there was no similar statewide ouster effort.

Others contend that the real story is the sizable number of incumbents who ran without opposition in the primary or face opposition only in the November general election.

"I don't see much change in the environment," said G. Terry Madonna, pollster and political analyst at Franklin and Marshall College. "There is still not much competition. Incumbents will still win convincingly this fall."

All told, more than 40 percent of state House members and 20 percent of state Senate members face no opponents this year, and only 8 percent of Senators and 14 percent of House members faced opposition in the primary. Of those with opponents in the fall, many face only token opposition, wrote Madonna and Michael Young in their political column, "Politically Uncorrected."

At least one of the incumbents who came up short on Tuesday night is not ready to concede the race yet. Geist says he is hoping the absentee ballot count may change the outcome. And if that doesn't pan out, Geist told the Altoona Mirror, he may run as a Democrat in November.

Contact Amy Worden at 717-783-2584 or aworden@phillynews.com or follow @inkyamy on Twitter.