ST. PETERSBURG — A nearly decadelong stalemate between the city and the Tampa Bay Rays ended Thursday after the St. Petersburg City Council agreed to let the club look elsewhere for a new home.

By a 5-3 vote, council members agreed to give the Rays three years to search for a new stadium site in Pinellas and Hillsborough counties.

For St. Petersburg, the vote promised a new start for Major League Baseball, if the Rays stay and build a more-modern stadium, or the transformation of 85 acres in prime downtown real estate that's now home to Tropicana Field, where the Rays have played since 1998.

For Mayor Rick Kriseman, Thursday's vote clinched a hard-fought victory. Twice before, Kriseman had failed to win over the eight-member council. This time around, he carefully lined up support with council members and made good on a 2013 campaign promise that he would reach an accord with the Rays, something his predecessors, Rick Baker and Bill Foster, didn't do.

"I want to thank our city council for approving this important memorandum of understanding with the Tampa Bay Rays," Kriseman said in a statement emailed minutes after the vote. "This agreement is good news for baseball fans, for our taxpayers, for the city of St. Petersburg, and for our entire region. I still believe the team's current site, reimagined and redeveloped, is the best place for a new stadium."

For Hillsborough County, the vote now shifts attention to its elected officials, who are lining up to woo the Rays.

"Mayor Kriseman did his homework and went back to the drawing board and found a way to get the votes that he needed," Tampa Mayor Bob Buckhorn said. "For the entire region, it was the right decision."

It took just under 90 minutes of discussion before council members made its historic vote.

"The opportunity in front of us cannot be missed," said City Council Chairwoman Amy Foster, who once opposed a similar deal with the Rays. "I see this as the only path forward."

Council members Charlie Gerdes, Karl Nurse, Darden Rice and Lisa Wheeler-Brown also voted for the deal. Council members Jim Kennedy, Steve Kornell and Ed Montanari voted against it.

The lack of drama was deceptive. It didn't come easy.

In December 2014, the council voted down a tentative deal struck by Kriseman and the Rays by a 5-3 vote. Council members said they were concerned about the city not getting a good enough deal on development rights to the 85 acres at Tropicana Field.

In May 2015, in a nonbinding vote, a slightly tweaked plan failed again.

In October, a plan by longtime opponent to a deal, Kennedy, passed the council by a 5-3 vote. But the Rays immediately rejected the deal, which would have required the team to pay up to $33 million for the right to look.

The momentum for a deal gathered strength in November when Wheeler-Brown, a supporter of Kriseman's efforts to reach a deal, won a tough race for a council seat occupied by term-limited Wengay Newton, a staunch opponent of any deal.

Wheeler-Brown's election secured the five votes Kriseman needed for the deal.

The omens for such a deal looked good from the start on Thursday, thanks to some politicking by Kriseman.

In contrast to 2014, Kriseman and Rays president Brian Auld met with each council member individually last week to explain the new deal.

Rays owner Stu Sternberg even made a cameo appearance during Thursday's meeting to make a humble appeal.

Sternberg thanked council members for their support. He said the team wants to stay in the Tampa Bay area for generations and apologized for the often dispiriting saga.

"I do feel badly that all the rhetoric that has gone on over the years," Sternberg said. "Everything has been done with good intentions. Baseball shouldn't bring any angst other than losing a baseball game."

Sternberg spoke for about 10 minutes. He emphasized the team's community service and how baseball binds families together across generations.

The soft touch worked.

Several council members who said they felt Kriseman tried to force the previous deal through in his first year in office, said he showed political maturity in gauging the council's reaction to the new deal before bringing it to a vote.

The major differences with previous versions are a joint interest-bearing account in which the Rays and city would share any development revenues from what is seen as a lucrative redevelopment opportunity at the Trop. If the Rays leave, they have to forfeit their share.

If they stay, they get 50 percent of proceeds.

Kriseman says this creates a financial incentive for the team to remain in St. Petersburg and, perhaps, use revenue generated by hotels, retail, condos and other amenities for its share of a stadium. A private developer who wanted to develop the whole site could also be required to kick in money for a stadium. The Rays would have three years to make a decision or forfeit the development money.

Kriseman's appeal to council members was brief.

"Your support today will give the city of St. Petersburg its best chance to be the forever home of the Tampa Bay Rays," Kriseman told council members.

Kennedy said he thought the deal would be a first step for the Rays to leave the region.

"This is just a starting point for a potential larger relocation," Kennedy said.

The Rays are now cleared to begin a three-year search in Hillsborough and Pinellas counties. Tampa seems the most likely destination.

Buckhorn said earlier this week he's looking forward to a resolution.

"I think (there's) the recognition, finally, that if we're going to keep the Rays as a regional asset, that they have to have the ability to look around the region and make what is, in their eyes, the best decision for their future here," Buckhorn said. "Once that occurs when that decision is arrived at and that site is determined, then whether it's Pinellas or Hillsborough, I think as a region we've got to rally behind it."

Major League Baseball, continuing its push for teams to shed outdated stadiums for more profitable venues, also signaled its support.

"Mr. Sternberg's patience and persistence throughout the franchise's long-standing efforts have illustrated his commitment to the fans of the region," it said in a statement. "We look forward to further progress in the weeks and months ahead as the Rays strive to ensure the future of the franchise with a first-class ballpark in the region."

After the vote, Sternberg and Auld said the team was excited to build a stadium with real grass and other amenities that would attract fans repelled by the aging dome at Tropicana Field.

"We want to build the first of the next generation of baseball stadiums," Auld said.

As for how long that might take, Sternberg said the team was entering uncharted territory.

"We haven't done it before," Sternberg said. "I don't know if it takes a week or six months to identify and figure out a site."

Times staff writers Richard Danielson and Marc Topkin contributed to this report. Contact Charlie Frago at (727) 893-8459. Follow @CharlieFrago on Twitter.