ROCKPORT, Maine — Republican Sen. Susan Collins announced Friday that she’s staying out of the Maine governor’s race because she believes she can do more good for the state by staying in Washington.

“I am a congenital optimist. I continue to believe that Congress can, and will, be more productive,” Collins said at a local chamber breakfast. “I want to continue to play a key role in advancing policies that strengthen our nation, help our hardworking families, improve our health care system, and bring peace and stability to a troubled and violent world.”

Speculation about Collins’ political future has been swirling for more than a year in her home state, where the moderate remains popular even as the Maine GOP has become more conservative.

Collins, 64, has been a consistent thorn in the side of Senate Majority Leader Mitch McConnell, R-Ky., as her willingness to go her own way has left him short of votes on key bills, most prominently his efforts to repeal the Affordable Care Act. It’s a role she’s embraced and one that she will continue to play in a Senate that, despite Collins’ optimistic statements, is likely to remain just as bitterly divided as ever in the years ahead.

Collins has also been a champion for those who want to hold President Trump in check: She was one of three Republican senators who sunk the Senate health care bill pushed by his administration. She also serves key roles on Appropriations Committee and the Intelligence Committee investigating Russian meddling in the 2016 presidential election.

The only Republican senator from New England has found herself among a dwindling number of GOP centrists like Arizona’s John McCain who are willing to work across the aisle. She’s not afraid to buck her own party: She introduced a bill to let transgender people serve in the military and opposed efforts to kill the Affordable Care Act without a replacement.

Collins, who has served for two decades in the Senate, was part of the Gang of 14 bipartisan senators that prevented the so-called nuclear option by Senate Republicans over an organized use of the filibuster by Senate Democrats.

On Friday, she spent much of her announcement touting the importance of finding bipartisan solutions to make health care affordable for all. She said her fellow lawmakers “must stop allowing partisanship to be a pre-existing condition.”

But her role has left her open to fire from both the right and the left.

And she’s on the outs with Trump. She said she couldn’t bring herself to vote for him, and she criticized him for failing to speak out more forcefully against racism, bigotry and anti-Semitism following the death of a woman at a white supremacist rally in Charlottesville, Va.

Collins grew up in Caribou, in far northern Maine. One of the middle of six children, she learned the importance of hard work by age 10 while plucking potatoes from the dirt for 30 cents per barrel. The only political race she lost was for governor, in 1994.

She has won her last few elections handily. She was re-elected with 68.5% of votes in 2014, 61.3% in 2008 and 58.4% in 2002. Her current term ends in 2020.

Her decision will likely free more gubernatorial candidates who have been waiting on the sidelines to enter the race. Two-term Republican Gov. Paul LePage cannot run again because of term limits.

The 2018 gubernatorial race could be a referendum on the legacy of LePage, whose administration slashed entitlement growth and touts a healthy state surplus. For all his successes, though, LePage is known for his bombastic leadership style.

The gubernatorial race is already a crowded field, with more than a dozen members of the Republican and Democratic parties having announced primary runs. And campaigning is already essentially underway.