PORTLAND, Maine (AP) — A crowded party primary is typically a recipe for nastiness and mud-slinging: Candidates with few political differences try to distinguish themselves with personal attacks on their opponents.

Then there is Maine.

In a campaign video flush with smiles and upbeat music, two Democrats running in the primary for governor gush about each other’s credentials — then encourage voters to support them both.

“So on June 12, you can vote for me first and Betsy second,” said Mark Eves, pointing to fellow Democrat Betsy Sweet standing beside him.

“Or, me first and him second,” added a smiling Sweet, former director of the Maine Women’s Lobby.

What’s behind all the backslapping bonhomie?

Eves and Sweet are employing a novel campaign strategy to match Maine’s new way of electing candidates. Maine is the first state to adopt a system called ranked-choice voting, which makes its statewide debut in Tuesday’s primary.

Also called instant runoff, the system is used in 11 local jurisdictions across the country and works like this: Voters rank candidates from first to last on their ballot, and the election is over if one candidate wins a majority.

If not, candidates are eliminated one by one, and their remaining votes are reallocated in what amounts to a mathematical game of survival. The process is repeated as many times as necessary until a candidate gains a majority.

The eventual winner might not be the candidate who had the most first-place votes, but rather the one who tallies the highest number of second- or even third-place votes. That explains multi-candidate strategies like the one used by Sweet and Eves, a former state House speaker.

The candidates said they decided to coordinate as a way to boost the chances that one of them would move on to the general election from a primary field of seven Democrats.

“We have a strong belief that we have to have a progressive Democrat on the ticket to win in November,” Eves said.

Advocates of the system say it helps promote civility, as in the Eves and Sweet campaigns, end election spoilers and ensure the eventual winner receives majority support.

Jim Betts, a Democrat and retired state worker, said he likes the new system because he thinks it’s already toned down the personal attacks.

“Everyone has shown some discretion,” he said. “I think that’s a real plus.”

It also has its detractors. Critics say ranked-choice is confusing and leads to bland campaigns in which candidates steer clear of contentious topics because they don’t want to alienate any voters.

“It homogenizes the election. Candidates are afraid to take hard stances on issues, and that’s something we want people to do,” said Republican Kurt Wright, who lost a 2009 ranked-choice mayoral race in Burlington, Vermont, despite having the most first-place votes. “People are so concerned about getting second-place votes that they’re afraid to offend voters.”

Burlington scuttled the system soon afterward.

In California, a candidate sued over ranked-choice voting in San Francisco , but the system was affirmed in a ruling by the 9th Circuit Court of Appeals that acknowledged there’s no such thing as a perfect voting system. San Francisco used the system this past week for its mayor’s race, which remains undecided as remaining votes from lower-placing candidates are being reallocated among the top two finishers.

There was controversy, but no lawsuit, across the bay in 2010 when former California state Senate leader Don Perata lost the Oakland mayoral race despite having the most first-place votes. He eventually lost narrowly to City Councilwoman Jean Quan after ballots were tabulated and re-tabulated a half-dozen times.

Not surprisingly, Perata is a critic of the system, mainly because it discourages candidates from being candid about their positions.

“It completely dumbs it down. What you’re trying to do is to not make mistakes, offend no one and say nothing, basically,” he said.

Maine residents approved the system in 2016 after nine of the past 11 gubernatorial elections resulted in winners who had failed to get a majority of the vote. The largely rural state has an independent streak that means the November ballot is usually filled with independents and candidates from a multitude of parties.

The current governor, Republican Paul LePage, first won election in a crowded field with only about 38 percent of the vote in 2010.

Maine’s largest city, Portland, already is one of the few municipalities nationwide that uses ranked-choice voting. It has been used once before in a statewide election, although on a limited basis — for a judicial race in North Carolina.

On Tuesday, Maine will become the first to employ it on a statewide basis. Voters also will be asked whether they want it to continue, with a ballot initiative that seeks to use ranked-choice for U.S. House and U.S. Senate elections in November.

State constitutional concerns prohibited the system from being used for state offices in the general election following an advisory opinion by Maine’s highest court. Supporters eventually hope voters will like ranked-choice enough to back a constitutional amendment so the system can be expanded to gubernatorial and state legislative races in the general election, said Kyle Bailey, a spokesman for the Committee for Ranked Choice Voting.

Moving toward a ranked-choice system started as a bipartisan effort but has since become highly politicized, with Republicans trying to delay or stop it in the Legislature and courts.

Republican gubernatorial candidate Mary Mayhew hasn’t coordinated her campaign with any opponent ahead of Tuesday’s primary. She instead is encouraging her supporters to circumvent the system by voting for her and leaving the rest of the ballot blank. Her spokeswoman, Zach Lingley, said Mayhew believes ranked-choice is unconstitutional.

Some voters are heeding the suggestion.

“I voted for one person — one and one only,” said Kent Long, an 80-year-old Navy veteran from Brunswick, who voted with an early absentee ballot in the GOP primary. “We vote for whom we think is best.”