TALLAHASSEE, Fla. (AP) — Trump-allied Republican Ron DeSantis was formally elected governor of Florida and outgoing Gov. Rick Scott elected U.S. senator on Tuesday when the state certified election results two weeks after tight margins prompted tumultuous recounts.

The Elections Canvassing Commission met at the Florida Capitol to certify the results of the Nov. 6 election after two weeks of contention and finger-pointing. The meeting lasted a mere five minutes.

The results: former U.S. Rep. DeSantis was elected by 32,463 votes out of more than 8 million cast, defeating Democratic Tallahassee Mayor Andrew Gillum. Scott defeated incumbent Democratic U.S. Sen. Bill Nelson by 10,033 votes.

In yet a third recount and the closest of any of the statewide races, Democrat Nikki Fried defeated Republican state Rep. Matt Caldwell by 6,753 votes for the Cabinet position of agriculture commissioner.

DeSantis was able to come from behind and decisively win the Republican primary with the help of President Donald Trump, who tweeted his support for DeSantis and campaigned with him in Florida. Trump returned to Florida two more times in the final six days before the election to help boost turnout for DeSantis and Scott.

DeSantis' victory means Republicans will go into their third decade controlling the governor's office and Legislature. While DeSantis didn't attend the election certification meeting, he did attend the House and Senate ceremonies as the chambers elected their new leaders.

DeSantis campaigned on continuing on the path Scott set for Florida and he's largely expected to govern in a similar fashion by attempting to cut government spending and regulations and trying to make the state more business friendly.

"I want to continue a lot of the things that Governor Scott is doing," DeSantis said during an interview as he campaigned. "In terms of cutting the government, I think the way I will approach that is with my line-item veto pen. When pork projects are put in (the budget), I will whip that out and I will make sure that tax dollars are being spent right."

He will also get a chance to change the state Supreme Court for years to come. Three of the court's liberal justices are retiring when he takes office. DeSantis has been a critic of the court, particularly in a decision that struck down a school voucher program signed into law by then-Gov. Jeb Bush. DeSantis called it an egregious example of judicial overreach.

"That is not good judging; that is basically acting as a super legislature," he said.

DeSantis has also promised to address Florida's growing water issues, such as dealing with pollutants from Lake Okeechobee that causes algae blooms downriver and the red tide that has bloomed off its Gulf and Atlantic coasts.

"I have heard Governor-elect DeSantis say some good things about his goals on environment and water policy. If that's an area where we can find some common ground and work together, I welcome it," said Democratic state Sen. Gary Farmer.

Scott's victory means that for the first time since Florida voters began choosing their U.S. senators, the state will be represented by two Republicans. He'll serve alongside Sen. Marco Rubio.

He campaigned on the promise he'd change Washington, particularly by pushing for longer work weeks for senators.

The election results were presented to the commission by Secretary of State Ken Detzner in a short ceremony void of fanfare.

By law, the commission is made up of the governor and two of the three Cabinet members. But Scott said during the middle of the recount with Nelson that he wouldn't participate in the certification. Instead, Republican Sen. Rob Bradley, Attorney General Pam Bondi and Agriculture Commissioner Adam Putnam, who lost the Republican primary for governor to DeSantis, served as the commission. Bondi and Putnam participated by phone.

"The voters can be assured that the results that we just certified reflect the intent of the voters in this election. Everyone who we certified as winners were the winners," Bradley said after the meeting. "Now it's time to turn the page and move forward with governing. The election season's over."

In 2014, Scott and all three Cabinet members declined to serve because each was on the ballot.

The recounts were reminiscent of the 2000 presidential election, when Florida took more than five weeks to declare George W. Bush the victor over Vice President Al Gore by 537 votes. Florida became the laughingstock of the world during the chaotic recount that decided the presidency.

Florida was under scrutiny this year as election officials in Palm Beach and Broward counties struggled to count the vote. Scott and President Trump suggested there was fraud in the largely Democratic counties, and several lawsuits were filed during the process.

Lawmakers have said they will look at election laws during the 2019 legislative session to avoid future problems.

___

AP writer Gary Fineout contributed to this report.

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.