BUFFALO, N.Y. -- Both had nearly 30 years of experience in law and the military, but in the end, it was Democrat John Flynn who won the race to become the next Erie County District Attorney.

"My friends, tonight we celebrate, tomorrow we get to work," Flynn said.

Flynn, the Town of Tonawanda Attorney, a commander in the Naval Reserves, and a former assistant district attorney, defeated Republican Joe Treanor, who was endorsed by Michael Flaherty, the acting district attorney who Flynn defeated in the primary. Flaherty replaced longtime DA Frank Sedita.

Flynn said priorities include building strong relationships with law enforcement, maintaining the public integrity unit begun by Flaherty, and making the office more proactive.

"I want to get out with the clergy, work with the community, work with elected officials, work with law enforcement, and do what I can do to help solve crime and solve the problems that allow crime to occur in our city," Flynn said.

For his part, Treanor said he was proud of his campaign. The retired Air Force Colonel also served in the JAG Corp and ran on the platform that he was a prosecutor, not a politican. He refused to accept campaign contributions, and says he hopes Flynn will keep politics out of the office.

"That's part of what my campaign was based on was the desire to bring what I refer to as 'pure justice' to Erie County, where you're not beholden to anyone," Treanor said.

That's something Flynn has pledged to do in the past.