Daniel Larkosh, a trial lawyer and West Tisbury resident, clinched the Democratic nomination for Cape and Islands state representative Tuesday, becoming the first Vineyarder to secure the position since the district was created in 1988.

Should he win in November, it will be the first time the Vineyard has had its own representative in the state house in over 30 years.

It was a highly contested primary featuring three Vineyard candidates, a Falmouth resident and a Nantucket write-in candidate who ran a highly successful campaign in his home county.

But Mr. Larkosh bested his competitors by being the only candidate to win outside his own backyard, sweeping the district of Falmouth where other Island candidates failed to make an impression.

Total turnout was 27 per cent for the district that spans Dukes County, Nantucket, and parts of Barnstable and contains 31,776 voters.

Mr. Larkosh did not win in any Vineyard towns, the largest voting block, though he placed second across the board. And like other Vineyard candidates he wrested just a few votes from Nantucket, where local write-in candidate Tim Madden secured the bulk of the vote in a record turnout.

But it was in Falmouth where Mr. Larkosh sealed the nomination, finishing first with 888 votes, more than 800 votes ahead of the other Vineyard candidates.

“I was really honored at the support in Falmouth,” Mr. Larkosh said yesterday, “I didn’t expect to do that much better than the Vineyard candidates and Mr. Madden.”

It was an election full of surprises. On Nantucket 2,454, or 31 per cent, of the registered voters turned out, a state primary record on that Island. But Mr. Madden’s overwhelming support on Nantucket was not mirrored in the rest of the district. He secured just 14 votes on the Vineyard and 120 votes in Falmouth, where write-in votes were not officially counted until Wednesday afternoon. The Falmouth vote brought his total vote to 1,402, putting him in second place above Tim Lasker of Chilmark, who won the Vineyard vote.

Roger Wey of Oak Bluffs finished a distant fourth with 819 votes. Meanwhile Catherine Bumpus, a candidate who appeared first on the printed ballot but had withdrawn from the race months ago, attracted 642 votes.

Mr. Larkosh traveled to Falmouth on Tuesday to meet voters going to the polls and his campaign ran a phone bank on the mainland as well as the Vineyard.

He puts some of his Falmouth support down to the fact that he was the sole vocal champion of the Cape Wind project, which enjoys wider support on the mainland.

“I don’t think they voted for me because of Cape Wind, but it did break for me,” said Mr. Larkosh, who added that he voiced his position in an early debate without knowing that the other candidates were against the project.

He said that the issue may not figure as large in November elections, since the remaining candidates are not as polarized on the issue.

Mr. Larkosh will now face three unenrolled candidates, including Melissa Freitag of Falmouth and Jacob Ferreira of Vineyard Haven. Mr. Madden, who ran a write-in campaign after missing the deadline to change party affiliation from unenrolled to Democrat, will also appear on the ballot and is expected to run.

Mr. Larkosh said he and his team will develop a strategy over the coming days.

“We’ll definitely approach this as a second campaign,” he said, “There will be different issues and a different strategy.”

He said much depends on Mr. Madden as to whether Nantucket is in play.

“We’ll be spending time over there, I want to earn their vote. But [if he’s running] it does marginalize Nantucket,” he said.

Speaking yesterday Mr. Madden said he will most likely run in the November election.

“I have to speak to my wife still,” he said, “I’m very heavily leaning toward running.”

Though he campaigned heavily in his home county, Mr. Madden spent little time looking for votes on the Vineyard during the primary, which he said was out of respect for the other qualified candidates.

“Now the race is more defined I feel more comfortable [campaigning on the Vineyard]. You’ll see a lot more of me,” he said.

He stressed that if elected he will switch to Democrat in office.

Mr. Madden’s showing in Nantucket may have been even stronger judging by the ballots bearing his name in the wrong spot according to the town clerk who managed vote counting. Nantucket town clerk Catherine Stover said many voters filled out their ballots wrong, entering Mr. Madden as candidate for representative of congress, for example, by mistake.

“If all the write-ins for Mr. Madden were written in the correct place — not just the votes in the Representative for Congress section of the ballot, he would have won quite handily,” wrote Ms. Stover in a comment posted yesterday on the Gazette Web site, adding the town clerk office is required to itemize each name that appears on the ballot.

The final tallies for the candidates were as follows: Dan Larkosh, 1,721 (871 on the Vineyard); Tim Madden, 1,402 (14 on the Vineyard); Tim Lasker, 1,320 (1,184 on the Vineyard); Roger Wey, 819 (728 on the Vineyard); David Moriarty, 744 (126 on the Vineyard); Catherine Bumpus, 642 (55 on the Vineyard).

Mr. Wey who is a longtime Oak Bluffs selectman and director of the council on aging, won his home town with 353 votes, or 40 per cent of the vote. He could not be reached yesterday for comment.

Five of the six Vineyard towns went to Tim Lasker of Chilmark who won 40 per cent of the Island vote. Mr. Lasker was initially reported to have been runner-up in the race overall, before it became clear from the final write-in tally that Mr. Madden was in front.

“I’ve had an unbelievably good time,” said Mr. Lasker of his campaign, “I can’t express how much I’m appreciative the support of Vineyarders and particularly the volunteers, so many of them were so young, too.”

Mr. Lasker, a digital media consultant, added that he has no immediate plans to continue in politics but that he will look to investigate the possibility of municipally owned wind utility on Noman’s Land, an idea he came up with during the campaign.

He added that he had telephoned Mr. Madden on Wednesday to urge him to run and confirmed that he will be throwing his support behind Mr. Madden in the November election.

“I’m very enthusiastic about his campaign,” he said, “I have talked to him at length about it.”