BOSTON — The four candidates for Massachusetts governor made their final pitch to voters Monday, with Democratic incumbent Deval Patrick trying to fend off a serious challenge from Republican Charles Baker amid an anti-incumbent, pro-GOP wave sweeping the country.

Independent candidate Timothy Cahill remained a warrior until the end, shaking commuters’ hands before sunrise and carrying on a largely solitary fight after the defection of his running mate and top campaign advisers.

Green-Rainbow Party candidate Jill Stein underscored her outsider’s credentials by making only one public appearance on the eve of the election.

“I knew four years ago that we would face headwinds,” Patrick told an evening rally in the city’s Roslindale neighborhood.

“I knew that we’d have the headwinds that come with being a newcomer, trying to break in and trying to move the ball forward and trying to change the way business is done on Beacon Hill.

“What I didn’t expect was a global economic collapse that would sweep Massachusetts up as it has the whole country.”

Gathering himself, he cited his lieutenant governor as he added: “Let me tell you one thing Tim Murray and I didn’t do: We didn’t cut and run like a whole bunch of folks who had this job before us. We stood right with you.”

Patrick’s election in 2006 broke a 16-year run of Republican governors pockmarked by the resignations of William F. Weld and Paul Cellucci, and the decision by former Gov. Mitt Romney to skip seeking a second term so he could run for president.

Baker had a simple pitch when asked what he wanted voters to weigh when they stepped into the booth Tuesday.

“I want them to think about whether Massachusetts needs a turnaround. I’m the only turnaround candidate in the race, having done one before,” he said, citing his transformation of Harvard Pilgrim Health Care from receivership to the top rankings in customer service.

Cahill, the state’s treasurer, didn’t hesitate in answering the same question.

“I want them to know I’m the candidate for the middle class. I’m going to fight for them as I’ve fought throughout this campaign, and I want them to have a choice, an election choice between the two-party system,” he said.

Monday saw the climax of a sometimes-surreal race that saw Cahill bolt from the Democratic Party to run as an independent; Baker give up a nearly $2 million salary at Harvard Pilgrim to run for a $140,000 job as governor; and Patrick try to withstand a tide of anti-incumbency that threatened the second half of his friend Barack Obama’s presidency.

Stein campaigned largely to appear in the 16 debates and forums between the candidates, while Cahill had to withstand twin embarrassments of his staff losses and the defection of his running mate, Paul Loscocco, who quit saying Cahill had no chance of winning.

The most recent polls showed Patrick and Baker close, with Cahill a distant third and Stein in the single digits.