Alice Stewart is a CNN political commentator and former communications director for Ted Cruz for President. The views expressed in this commentary are solely hers.

(CNN) Voters in The Cotton State listened to native son Charles Barkley and drew a line in the sand. They showed the country that they are not "a bunch of damn idiots" and sent the message that policy is one thing, but the quality of the candidate is more important.

On Tuesday, voters chose to elect a liberal candidate to the US Senate instead of an accused child molester.

In ruby red Alabama, this was GOP candidate Roy Moore's race to lose . A Democrat has not held a US Senate seat from Alabama in more than 20 years. Moore's conservative values reflected those of many in the state: pro-life, pro Second Amendment, strong on fighting crime and strong on immigration reform.

My first job was in Dothan, Alabama. These folks are strong in their faith, family and commitment to community. They know right from wrong and fact from fiction. They won't let Washington or the media tell them what to do and how to vote. Instead, they demonstrated that principles take priority.

As Senator-elect Jones said in his acceptance speech, Alabamians "have shown the country the way" they "can be unified."

This should serve as a wake-up call for President Trump and the Republican Party.

The President's constant attacks on women and African-American voters have taken their toll. His last-minute efforts to seal the deal in Alabama fell short because his demeanor has been debilitating to a lot of conservative voters.

JUST WATCHED Roy Moore: It isn't over Replay More Videos ... MUST WATCH Roy Moore: It isn't over 00:49

When Moore was recently accused of sexually harassing several women, 40 years ago -- including a 14-year-old -- his senate hopes appeared to be derailed. I believed the women. In my view, their allegations were more credible than his denials. He should have quit the race weeks ago.

After initially shunning Moore, President Trump and the Republican National Committee (RNC) chose to fully endorse him. They wanted his vote in the Senate.

That decision was unfortunate. One vote is not worth the character of the Senate. I would have preferred the GOP to rally behind a write-in candidate with integrity.

This is a case where the President and the RNC should have played a longer game. They should have been willing to lose one battle to win the war for the heart and soul of the Republican Party.

President Trump tweeted his "congratulations" to Jones, adding "the write-in votes played a very big factor."

Follow CNN Opinion Join us on Twitter and Facebook

That's true. Jones captured more than 49% of the vote, compared to Moore's more than 48%, with write-in votes totaling almost 2%. Assuming, for the sake of argument, that the write-ins were for Republicans, Moore would have won.

But Republicans cannot overlook the fact that write-ins would not have been a factor if we had the right candidate in the first place.

The all-important 2018 battle for control of the US Senate is the next battlefield.

With the Jones victory, Republicans now hold a slight 51-49 majority in the Senate. Next year, Democrats hold 25 of the 33 seats up for re-election. With the Alabama victory, many Democrats are optimistic about a majority in 2018. It's not out of the question if Republicans don't start delivering on campaign promises.

Moore was hoping a recount would change the outcome of this disastrous Steve Bannon political science experiment. It won't. At the end of the day, Moore will ride out on that horse he rode in on and the GOP will reflect on the reality that character counts and decency delivers votes.