Republicans lost Tuesday in an Alabama U.S. Senate race for the first time in 25 years.

Republicans lost the Virginia governorship last month, despite Ed Gillespie getting more votes than any Republican gubernatorial candidate in the state’s history. The GOP also lost 14 Virginia House of Delegates seats, and four races are still being recounted – enough for Republicans to potentially lose control after 17 years in the majority.

In New Jersey, an unpopular Republican governor doomed the GOP candidate to a decisive defeat with 42 percent of the vote. Despite this outcome, the legislative elections were essentially a draw.

Republicans need to spend January developing a new strategy capable of changing current patterns and maximizing their chance to keep the House.

The FiveThirtyEight.com website estimates the current generic ballot is now 47.2 percent Democrat and 37.5 percent Republican. If this stabilizes at that level, 2018 will be a disaster for Republicans.

Those Republicans who take comfort from the special elections in the House of Representatives should look carefully at the details. Every special election the GOP has won since the 2016 elections has involved districts that are either strongly Republican or voted for President Trump. Despite massive spending by various GOP groups, these victories have all been smaller than the 2016 margins in the same districts.

In both Alabama and Virginia, the Democrats were energized and turned out.

Meanwhile, Republicans are divided: Alabama was a GOP civil war; many Republicans are unhappy with their leaders in Washington; and independents are being alienated by both  President Trump and congressional Republicans.

As a first step back from the edge of disaster, Republicans must pass tax cuts by the end of this year and continue economic growth.

However, it is increasingly clear that vastly more must be done.

Republicans need to spend January developing a new strategy capable of changing current patterns and maximizing their chances to keep the House. They also must increase their Senate majority by five or six, so it will be strong enough to keep the majority in 2020, when the playing field will favor Democrats.

Every Republican, beginning with the president and vice president, needs to understand what a disaster a House Speaker Nancy Pelosi and a Senate Majority Leader Chuck Schumer would be.

By June, it may be too late to course-correct. Avoiding a Democratic wave election requires action now.