Mitt Romney marched into the Massachusetts State House in 2003 as a self-declared reformer, pledging to fix a judicial nominating system he decried as riddled with patronage and backroom deals.

Quoting John Adams, the new governor vowed to appoint judges purely on merit, put partisanship aside and restrict political contributions by those applying for the bench. “The citizens of Massachusetts deserve to have a squeaky-clean process that has no room for politics and favors,” Romney said as he announced changes to judicial selection that were hailed as a national model.

Three years later, Romney changed course. He effectively took over the independent judicial-screening commission he had unveiled with such fanfare. And as he geared up to run for president in 2008, he dismissed members of the commission who were resisting his choices for judgeships, according to documents and interviews.

Romney’s judicial nominees and his ill-fated effort to revamp a politicized system offer a window into how he made some of his most important decisions as Massachusetts’s chief executive. As a Republican governor in a strongly Democratic state, he started as a good-government idealist, bumped up against an entrenched system and ultimately decided to work within it. And if, as Romney suggests, his time as governor is a key selling point for the presidency, his judicial appointments may be one of his most lasting legacies.

Though he once said people connected to state government would be at a disadvantage in seeking judgeships, Romney ended up appointing seven lawyers from inside his administration.

In his final 17 months in office, he pushed through a surge of judicial nominees, some with controversial records, others with the kind of political connections he once condemned, records show. They included a former consultant for Bain & Co., the consulting firm where Romney made his reputation in business;a former Republican legislator rejected as too political by the screening panel; and a court clerk who had been reprimanded for asking a female co-worker to perform a lap dance at a strip club.

Before leaving office, the governor was forced to withdraw several nominees.

Judicial appointments often spark political fights, especially in a divided government. Romney’s Republican predecessor, Jane Swift, also drew criticism for late-term nominees deemed too political, including the Republican state House leader and a longtime GOP operative with no court experience.

The current governor, Deval L. Patrick (D), has been generally praised for his state Supreme Court choices, including the first black chief justice. But a number of his lower-court nominees have faced controversy, including a woman whose husband, a Democratic state representative, had donated tens of thousands of dollars mostly to Democrats, including Patrick.

Unlike other governors, Romney promised far-reaching reforms.

“About 65 percent of these people [who were] appointed judges in Massachusetts — I’m not saying they’re not qualified, but they got appointed because of who they know,” said Christopher Iannella Jr. (D), the longest-serving member of the Massachusetts Governor’s Council, the Colonial-era body that approves nominees. “Romney tried to change it, and I don’t think he was successful. I don’t see any difference between him and the rest.’’

Andrea Saul, a spokeswoman for Romney’s presidential campaign, said that he “put in place groundbreaking reforms” and “selected for the bench men and women who he felt had the appropriate temperament, judicial philosophy and demonstrated capability to be a judge.”

Eventually, she said, Romney thought his screening commission was intruding on his “constitutional power to make appointments.” Former Romney aides said he was frustrated that the commission’s rigorous reviews were slowing the process; the body had rejected nearly 80 percent of applicants.

During Romney’s term, the eight elected members of the Governor’s Council were all Democrats. His lieutenant governor, Kerry Healey, was an “ex officio” member, but her primary role was to break ties, which are rare.

Romney appointed 65 judges to trial and appellate courts along with 15 clerk-magistrates, who manage courts and hear traffic and small-claims cases. Romney, who praises U.S. Supreme Court conservatives, made no appointments to the Massachusetts Supreme Court. His lower-court nominees have compiled a generally moderate record, and even Democrats lauded his commitment to diversity on the bench.

In his first years as governor, his appointments tended to be Democrats or independents, voting records show, a finding that drew notice in the Boston Globe. One nominee was an openly gay man active in gay rights groups, put on the bench after Romney began crusading against same-sex marriage.

In his final year as governor, Romney’s appointments shifted to the right. Of those who registered as belonging to a political party, nearly half were Republican, in a state where only about 12 percent of registered voters are Republicans, voter records show.

Romney’s early reforms reflect his reputation as a corporate “Mr. Fix-It,” a style he promises to bring to the White House.

His approach to judges was “somewhat technocratic,” said Peter Vickery, a Democrat and former Governor’s Council member. “He has a great deal of faith in systems, and he assumed his system was almost like a machine that would run itself, and that popping out the other end would be non-controversial nominees. In the end, that didn’t happen.”

By the close of Romney’s tenure, those who had welcomed his new policies were disappointed.

“Sadly, the promise of a reformed judicial nomination process has gone the way that so many political promises go,” Governor’s Council member Mary-Ellen Manning (D) said in a 2006 statement, included in documents at the group’s office. She pointed to Romney’s promotion of a judge who had given nearly $20,000 in political contributions to the lieutenant governor and others.

At the time, Romney said that the judge was “highly qualified” and that the donations had been made before he became governor.

A new process

As the newly elected governor, Romney — who had gained a reputation for helping clean up the 2002 Salt Lake City Winter Olympics — signed an executive order promising a merit-based, nonpartisan process for naming new judges.

To avoid favoritism, a revamped Judicial Nominating Commission would initially screen candidates without knowing their identities. A “code of conduct” limited contributions from judicial nominees and banned them from campaigning for judgeships.

“Romney was very interested in new thinking,” said Daniel B. Winslow, Romney’s first legal counsel and now a Republican state representative. “He basically wanted us to remove insider politics from judicial appointments.”

But not only were the screening panel’s rigorous reviews slowing the pipeline of candidates, women’s groups were complaining that the nominees were overwhelmingly male.

In July 2005, Romney sidestepped his reforms and bypassed the screening panel, nominating Springfield lawyer Henry L. Rigali for a juvenile court judgeship. The year before, the panel declined to recommend Rigali, viewing him as weaker than other candidates, according to documents and one member.

Romney cited Rigali’s experience as a lawyer and prosecutor and an urgent need to fill the position. But his decision to ignore the panel triggered a furor, and Rigali asked the governor to withdraw his name.

The same week, the Boston Herald published the divorce records of longtime state prosecutor Renee Dupuis, whom Romney had nominated for a juvenile court judgeship. In the records, her ex-husband claimed that she had threatened to shoot him during a custody battle. Romney’s administration was surprised by the revelations, according to several Governor’s Council members.

After Romney put the nomination on hold and asked his screening panel to look at Dupuis again, it recommended that she be confirmed, people familiar with the process said. The bitterly contested divorce had included allegations of wrongdoing from both sides, according to Dupuis’s deposition in the case, obtained by The Washington Post.

But without explanation, Romney nominated someone else, drawing fury from women’s groups. “They ran away from her because they were afraid it might look bad in a national campaign,” said Pamela E. Berman, then president of the Women’s Bar Association of Massachusetts.

Dupuis was renominated by Patrick, and the divorce was not an issue in her confirmation. She declined to comment.

In the meantime, a revolt was brewing on the judicial screening panel.

Christopher Moore, Romney’s new chairman, told members in 2005 that the governor wanted judges who were pro-business, tough on crime and not liberal “activists,” according to three people who heard his statement and who spoke on the condition of anonymity because the proceedings were confidential. They said it was unclear if Romney knew of Moore’s comment, although he indicated he was speaking for the governor. Moore declined to comment, citing confidentiality.

Some members resisted.

“They were trying to change the process,” said Howard M. Kahalas, a Boston lawyer who served on the panel for Romney and two other Republican governors. “Before, they didn’t care about politics, and then it became business as usual.”

The tension boiled over late that year when Romney’s aides pushed the panel to recommend Merita Hopkins, chief of staff to Boston’s longtime Democratic mayor, Thomas Menino. Some members resisted, saying she was unqualified, according to five people familiar with the nomination. The panel tabled its vote.

In February 2006, Romney sent a letter to Kahalas, taking him off the panel. The governor also removed four others, some of whom had opposed Hopkins.

The same month, he wrote commissioners to tell them that their role would be limited to determining the “educational and experiential qualifications” of applicants. “I reserve to myself the responsibility to evaluate judicial temperament and philosophy,” he added. He also asked the panel for more candidates, especially women and minorities.

At the time, Romney aides said the commission had been too exacting in its reviews and wasn’t forwarding the governor enough applicants.

But Robert Holloway, who had reviewed aspiring judges for Romney’s three Republican predecessors, said the governor had “marginalized” a panel known for its independence. “If the only role of the commission is to look at where a person went to school and their experience on a résumé, I don’t see why you need it at all,” he said.

The reconstituted panel gave Romney what he wanted: Hopkins was nominated two months later and is now a superior court judge. Neither she nor Romney agreed to comment on her appointment.

Saul, Romney’s spokeswoman, said the panel was interfering with his gubernatorial prerogatives. “When it became clear [the panel] was going beyond simply reviewing candidates for their qualifications and was acting more like the appointing authority itself, the governor clarified their role,” she said.

A Bain connection

Six days after he limited the role of the commissioners, Romney nominated Andrew R. Grainger for the Massachusetts appeals court, extolling his experience, including as head of a pro-business legal foundation.

He did not disclose that one of Grainger’s clients at a consulting firm he headed in 1997 was Bain & Co., where Romney had been an executive.

At his hearing before the Governor’s Council, Grainger said he had helped limit legal expenses at Bain. Council member Carole Fiola, saying candidates with more legal experience had been passed up, asked him: “Why do you think you rose to the top?”

“I just don’t know what to say,” Grainger replied.

He said recently through a court spokeswoman that he “might have been in the same room once or twice with Romney” at Bain but that Romney would not have known him. Romney’s spokeswoman declined to comment on the Grainger nomination.

In his final year in the governor’s office, Romney achieved his goal of more candidates: Forty judges were appointed that year, at least 16 of whom were women or minorities.

Some of the nominees brought political or personal ties; there was the law partner of a Judicial Nominating Commission member, a woman related to a Republican state representative and a legal counsel to two former GOP governors.

At the time, former aides said, Romney was under pressure from Republicans to appoint certain judges, since his successor was a Democrat. He resisted in several cases but knew that “it was politically helpful for him to appoint conservatives,” said one former Romney aide, who spoke on the condition of anonymity to discuss internal matters.

After pledging not to rush through last-minute nominees, Romney nominated 10 more judges and four clerk-magistrates, including Stephen G. Carreiro, slotted for a housing court outside Boston.

It later came out that Carreiro, who had been running the court on an acting basis, had been accused by an employee of suggesting that she join him for lunch at a strip club called the Foxy Lady. “Mr. Carreiro further suggested that I should perform either a ‘lap’ or ‘table’ dance at this establishment,” the woman’s complaint said.

A letter of reprimand from the housing court says Carreiro violated sexual harassment policy. At his nomination hearing, he said his comment had been misinterpreted. “I would never ask that person for such an act. That’s insulting,” he said. Carreiro declined to comment for this story.

“His conduct would not be acceptable at McDonald’s, let alone in a court of law,” said Marilyn M. Petitto Devaney, a member of the Governor’s Council. Romney withdrew Carreiro’s name.

For a clerk-magistrate post on Cape Cod, Romney nominated Edward B. Teague, a former GOP leader of the Massachusetts House. Romney’s screening panel had rejected him as political, according to three people familiar with the nomination.

“Isn’t this precisely the kind of nomination that Governor Romney said he would not make?” Vickery, the Governor’s Council member, asked at Teague’s hearing.

“I don’t suspect that he did it because of any political bona ­fides I have,” Teague responded.

In a recent interview, he pointed to his more than five years of clerk experience when the governor appointed him. He was approved three weeks before Romney left office.

A day before Romney departed, the council approved Robert E. Powers, a longtime state prosecutor, to run another Cape Cod courthouse. Late last year, Powers was charged by a state Supreme Court committee with aggressive conduct that “frightened, embarrassed” and demoralized court employees. Powers took weeks to issue rulings that should have taken a day, the charges said.

The state’s high court will decide whether Powers will be disciplined, including possible firing. His attorney, Peter J. Haley, said that the incidents were “isolated” and that other litigants testified at a recent hearing that Powers had been “courteous, diligent and respectful.”

Staff writer Tom Hamburger contributed to this report.