Brian Trainor, a former assistant district attorney and the second in command of the St. Tammany Sheriff’s Office, cruised into first place in the race for 22nd Judicial District Attorney, where he will face Covington attorney Warren Montgomery in the Dec. 6 runoff.

Trainor received 35,897 votes, or 38 percent, in complete but unofficial returns. Montgomery got 23,730 votes, 25 percent.

The two surged to the top of a field of four candidates, vying to replace Walter Reed, who announced that he would not be seeking a sixth term. Slidell attorney Alan Black was in third place, while Covington attorney Roy Burns was in last and conceded before the last precincts were counted.

Trainor said that he knew he was unlikely to win outright in the primary, and his goal was to the top vote-getter going into the runoff. “I’m energized,’’ he said last Tuesday. “We’re where we wanted to be.’’

He said Washington Parish, where he got 30 percent of the vote, behind Bogalusa native Alan Black, was important in his strategy. Washington Parish Sheriff Randy “Country’’ Seal endorsed Trainor at his victory party at Sal & Judy’s in Lacombe.

Trainor said that he will reach out to Black and Burns, who he said did not run especially negative campaigns — a veiled shot at Montgomery who put a flyer that observers called the first negative piece in the hotly contested race.

Montgomery, for his part, said that his goal was to make the runoff. His campaign took a poll early on that showed voters wanted someone with integrity who was a proven crime fighter. The former federal prosecutor said he was the ideal candidate based on those criteria but was an unknown to voters and had to work to change that.

Montgomery said that he will seek the support of Black and Burns, who he said were running as reformers.

“I believe that the message of our campaign is the message that they wanted bring to their supporters, and I’m hopeful that their supporters will bring their allegiance to my campaign,’’ he said.

He called Trainor an “incumbent to all intents and purposes...he represents the establishment,’’ while the others in the race strove to be forces for change.

With the primary finished, one of the two will be elected the first new district attorney for St. Tammany and Washington parishes in 30 years.

Reed, who had an iron grip on the office, was assailed by negative media reports and revelations that he is the subject of a federal grand jury investigation that focuses at least partly on his use of campaign funds.

Trainor, the perceived front-runner, raised and spent the most money in the race, with Montgomery running a mostly self-funded race. Trainor was also the subject of the most attacks from his opponents, who painted him as too closely aligned to Sheriff Jack Strain to be able to claim independence.

Follow Sara Pagones on Twitter at @spagonesadvocat.