NEW YORK (AP) — The race for Brooklyn district attorney, practically an election afterthought in years past, is steadily heating up.

A stream of attacks and harsh ads have piled up since longtime DA Charles "Joe" Hynes lost the Democratic primary to former federal prosecutor Ken Thompson and flipped sides to run on the GOP and conservative lines.

Thompson's win marked the first time in a century that a sitting Brooklyn district attorney was ousted, and he would be the borough's first black DA. Hynes initially said he would make the transition smooth, but he later decided to actively campaign. His name will appear on the GOP and conservative lines.

Political experts say Hynes has a difficult road, in part because of a perceived anti-incumbent sentiment among voters.

"It is a very real moment, and Thompson is capitalizing on it," said Christina Greer, assistant professor of political science at Fordham University. "Everyone's time comes to an end."

Both sides have kicked up attack ads, with Thompson accusing Hynes of turning his back on the people of Brooklyn and Hynes saying Thompson lacks the leadership ability to shepherd the office. Both sides have linked the other to convicted public figures; Thompson with former Assemblyman Clarence Norman and Hynes with disgraced former New York state judge Sol Wachtler.

"The candidates should be emphasizing their records on crime and crime mitigation," said Jamie Chandler, political scientist at Hunter College. "But part of this negativity is reflected in the larger trend of nastiness across campaigns. It may work, but it's scraping the boundaries of what's acceptable."

Most of the major endorsements, from powerful Jewish rabbis to Sen. Charles Schumer and The New York Times, have gone to Thompson. The borough is overwhelmingly Democratic. Of more than 1.3 million registered voters, about 985,000 are Democrats, 124,000 are Republicans and 5,000 are Conservatives, according to the city's Board of Elections.

In the primary, only about 20 percent of Democrats voted, and Thompson won by about 18,000 votes. Hynes, first elected in 1991, is banking on the idea that more voters will turn out for the Nov. 5 general election. He has said he was urged to campaign by supporters shocked that he had lost and concerned about the future.

"At the end of the day, in the general election when all of voters of Brooklyn — Democrats, Progressives, independents, Republicans and Conservatives — have an opportunity to compare the record, I think I drive home another win," Hynes said.

The Brooklyn district attorney's office is one of the nation's largest, with more than 1,500 new cases a week. It handles more than 80,000 cases per year. Hynes, 78, hasn't had a serious challenger in years and ran unopposed in 2009. He has been considered an innovator nationwide, with a tough-on-crime stance that gets results.

"When I became DA, Brooklyn was the fifth most violent place in America with 158,000 serious felonies, and 760 murders," Hynes said. "Thirteen years later, Money magazine said we were one of the 10 best places to live in America."

Thompson, 48, best known for his defense of the hotel maid at the center of the Dominique Strauss-Kahn sex assault scandal, has a solid reputation as both a defense attorney and federal prosecutor in Brooklyn who tried the infamous police brutality case against Abner Louima in 1997. Louima, who moved to Florida more than a decade ago, appeared this weekend with Thompson to campaign.

"God has answered our prayers," the soft-spoken Louima said. "The change that we've all been waiting for is here."

Thompson has said he wants to bring innovation and change to the office, through training, technology upgrades and smart prosecutions. "People who voted for me want change — black and white," he said.

He also recently said that he would not prosecute low-level marijuana cases involving less than 15 grams of pot, because he believes the resources would be better spent on more serious crimes. He'd offer noncriminal fines, instead, he said. There were nearly 12,000 arrests for the low-level charge last year, and that involves hours of manpower to prosecute.

Thompson's ideas seem to resonate more with voters, said Greer.

People in Brooklyn are "looking for someone who is going to innovative," Greer said. "And that, these days, is Thompson."