The Senate on Thursday narrowly confirmed Rep. Jim Bridenstine as NASA administrator, despite deep concerns from Democrats that he lacks the scientific and management expertise to lead the space agency.

The vote to install the three-term Oklahoma Republican was 50 to 49. President Trump had initially tapped Bridenstine for the post last year, but his nomination stalled amid Democratic criticisms, as well as some reticence from Sen. Marco Rubio (R-Fla.), who said Thursday that NASA should be led by a professional with a background in space. 

Rubio ultimately sided with all other Republicans to confirm Bridenstine as the NASA chief despite his hesitations, arguing that Trump deserves to have his team in place across the administration. 

“I was not enthused about the nomination. Nothing personal about Mr. Bridenstine. NASA is an organization that needs to be led by a space professional,” Rubio said before the confirmation vote Thursday afternoon. But he said that “my view of it is, and it has been the tradition of the Senate for the entire distance of the republic, that we give great deference to the president on choosing qualifications.” 

Bridenstine's confirmation comes at a critical time for the agency, which is preparing to return to the moon and to restore human spaceflight from United States soil, a capability that was lost when the space shuttle program was retired in 2011.

The space agency has gone without a permanent leader for 15 months, since Charles Bolden resigned as Trump took office. During that time, Robert Lightfoot, a NASA veteran, has been running the agency. But he recently announced that he will retire from the agency at the end of this month.

Bridenstine is a former naval aviator who ran the Tulsa Air and Space Museum before coming to Congress in 2013. An avid supporter of space exploration, he sponsored the American Space Renaissance Act, a wide-ranging bill that touched on national security, how best to deal with debris in space and how to regulate the commercial space industry.

“I look forward to working with the outstanding team at NASA to achieve the president’s vision for American leadership in space,” Bridenstine said after he was confirmed.

Democrats seized on Bridenstine’s lack of scientific expertise, as well as his comments on climate change, to make their case that he is unfit to lead the agency. 

“James Bridenstine is a climate denier with no scientific background who has made a career out of ignoring science,” Sen. Brian Schatz (D-Hawaii) said Thursday. “Now, I also don’t have a scientific background. But I defer to scientists. I rely on the scientific consensus. And the scientific consensus is not what Mr. Bridenstine says.”

A procedural vote Wednesday to advance Bridenstine’s confirmation almost failed as Sen. Jeff Flake (R-Ariz.) sided with Democrats to block him, only to switch his vote after some time had passed. Senate Republican leaders said Flake wanted to speak with Mike Pompeo, Trump’s nominee for secretary of state, about travel restrictions to Cuba before he could commit to advancing Bridenstine’s nomination. 

Had Flake remained a no on that vote, it would have caused significant complications, with Vice President Pence, who as the president of the Senate is the official tiebreaker, in Florida to attend Trump’s meeting with Japanese Prime Minister Shinzo Abe. 

As Flake remained a holdout, Pence called the senator, who said that he wanted to discuss lifting travel restrictions to Cuba with Pompeo, according to a person familiar with the discussions. 

The senator, a frequent Trump critic, caused some suspense again Thursday when he held off voting to confirm Bridenstine. He again spoke privately with Pence off the Senate floor during the vote, although he declined to elaborate on their talk. Flake ultimately voted yes.