Conservative Virginia Beach legislator Robert F. "Bob" McDonnell easily defeated Richmond lawyer Stephen E. Baril last night in the race for the Republican nomination for state attorney general, capping a primary that was marked by impressive spending and personal attacks from both candidates.

With nearly all precincts reporting, Virginians backed McDonnell over Baril by a healthy margin as the GOP candidate for attorney general this fall. In the Nov. 8 election, McDonnell will face Democratic Sen. R. Creigh Deeds (Bath), who was unopposed yesterday.

McDonnell -- supported by a long list of Republican heavyweights and religious conservatives -- campaigned heavily on his conservative and "pro-family" record from 14 years serving in the House of Delegates.

In his quest to become the "people's lawyer," Baril had argued that his years of experience in a Richmond law firm made him the better candidate -- while he attempted to appeal to more centrist Republicans and business owners.

"I'm a very happy man," McDonnell said, shortly after he gave his victory speech last night. "I'm relieved and honored that tens of thousands of Virginians picked me to work with [GOP gubernatorial nominee] Jerry Kilgore to advance our conservative principles in the election in the fall. . . . I think it was my proven conservative record that made the difference."

Baril said his campaign had done its best against a "formidable" opponent with legislative experience and a passel of key endorsements, including those of former governor James S. Gilmore III and U.S. Rep. Thomas M. Davis III (R-Va.).

"He marshaled those resources well," Baril said. "We ran a hard race. We pushed him to the limit, and I think that's a credit to us."

Political observers said that the primary battle was noteworthy because of the amount of money that was spent and the personal attacks waged by the candidates. According to election reports, McDonnell raised nearly $1.9 million and Baril $1.7 million, and they bought mailers and other advertising at a rate political analysts say is rare for a second-tier office, even one that is considered a steppingstone to a gubernatorial bid.

In the waning days of the primary battle, McDonnell and Baril held dueling news conferences, and each accused the other of ethical lapses. Baril toted a box of Tide laundry detergent and urged McDonnell to "come clean."

"They're spending an enormous amount for a lower-ballot race," said Larry J. Sabato, director of the Center for Politics at the University of Virginia. "It's been exceptionally nasty and mean. . . . They clearly dislike each other intensely. These types of charges are rare for an attorney general's race."

Throughout the campaign, each sought to burnish his conservative credentials in a year in which some moderate Republicans have struggled. Baril targeted voters in rural Virginia with his views on Second Amendment rights; McDonnell stressed his votes for tax relief and support from social conservatives such as the political action committee of the Virginia Society for Human Life. Baril was considered the "moderate" in the race, Sabato said.

McDonnell, a member of the House of Delegates since 1992, is the chairman of its Courts of Justice Committee, which acts on judicial appointments. He is a partner in the Virginia Beach law firm of Huff, Poole & Mahoney PC, and previously worked as an assistant commonwealth's attorney in Virginia Beach.

During the campaign, McDonnell called for longer sentences for sex and drug offenders and formulated an anti-terrorism plan that proposes making permanent the Office of Commonwealth Preparedness and conducting more mass-casualty drills.

Baril wanted Virginia to hire 100 state police officers and to expand drug-related court programs, including faith-based initiatives, that provide supervised treatment. He also said the state should spend $1 billion a year on transportation over the next decade, a stand advisers hoped would win him support in Northern Virginia's business community.

Del. Robert F. "Bob" McDonnell had the backing of many Republican leaders.Stephen E. Baril touted his years of experience in a Richmond law firm.