Well, that prediction’s looking a tad shaky. Many other commentators and I forecast that Virginia Republicans would register their third win in a row and wrest control of the state Senate from the Democrats in Tuesday’s legislative election.

It was much closer than anticipated. It looks like we were right, by the narrowest of possible margins. But the final outcome will apparently depend on a recount.

So while I’m reluctant to analyze the final result, I can draw some initial conclusions.

First, neither party won a resounding mandate. After overwhelming Republican victories in 2009 and 2010, the result suggested that voters in the Old Dominion were demonstrating a taste for divided government that they’ve favored in the past.

The Republicans easily retained their control of the House of Delegates and even added a half-dozen seats or so. (At least we got that right.) Partly through redistricting, they defeated the Democrats’ leader in the House, Ward Armstrong.

So the only question was whether the GOP would win the Senate as well. That’s the high-stakes race, because victory there would give the Republicans full sway over both the executive and legislative branches in Richmond.

The Republicans gained at least one Senate seat. As I write, they were ahead by a razor-thin margin in another. If they win both, it’ll be deadlocked at 20-20. In that case, the GOP has the edge, because Republican Lt. Gov. Bill Bolling breaks ties in the chamber.

“It’s not just a tie at 20-20. It’s a tie that leans red,” said Bob Holsworth, a longtime political commentator and former Virginia Commonwealth University professor.

Regardless of the final result, it’s not as strong a showing as the Republicans were expecting. The voters balked at giving them a third straight sizable triumph.

Especially in Northern Virginia, many voters apparently were worried that Republicans might go too far if they had unfettered control. The Democrats had some success arguing that a GOP monopoly would lead to a surge of conservative legislation on hot-button social issues including gun control, immigration and abortion.

Second, the Democrats aren’t as moribund as they looked. Their resilience should give the party hope that it can deliver the state for President Obama again in 2012. His victory in 2008 was the first presidential win for the Democrats in Virginia in 44 years.

Republicans and Democrats said the intensity of anger among GOP voters toward Obama and overspending in Washington seemed to have faded a bit from 2009 and 2010. The GOP success in winning control of the U.S. House was partly the reason, because it contributed to a feeling that the message had been spent.

“When it switches from Democrat to Republican in Congress, it takes a bit of pressure off the valve,” said a senior Republican campaign consultant, who spoke on the condition of anonymity because he was not authorized to speak for the party.

With Obama on the ticket next year, Democrats hope many minority and young voters, who favor the Democrats but typically sit out off-year elections, will come to the polls. Also, there will be a marquee U.S. Senate race between former governor Tim Kaine (D) and former governor and U.S. senator George Allen (R).

Third, the Democrats also benefited from having redrawn the lines for state Senate districts to protect incumbents.

On the other hand, the Democrats were successful only in the sense that they defended their turf better than expected. They didn’t manage to pick off any Republicans. And if it’s confirmed that the Republicans won that 20th seat, then they will have a working majority — if not outright control — in the Senate.

The Republicans made gains partly owing to the popularity of Gov. Bob McDonnell and partly to dissatisfaction with the state of the economy.

They also recruited many more candidates — and strong ones — to challenge Democratic incumbents. That gave them more opportunities to pick up seats.

With a closely divided Senate, McDonnell will have a harder time than he’d hoped in pushing through an unfettered conservative agenda of shrinking government and low taxes.

But it will save him the trouble of having to deal with a resurgent conservative wing that would expect him to move significantly to the right on social issues.

That would have stirred up a lot of controversy that would disrupt McDonnell’s overall approach, which has been to emphasize less disputatious topics such as jobs and the economy.

And if the GOP does, in fact, pick up that 20th seat, then McDonnell and the GOP can fairly boast that they won full control in Richmond — just barely, but for real — for the first time in a decade.