WASHINGTON (Reuters) - The newly appointed second-in-command at the U.S. Justice Department faced a weighty task just two weeks after taking office - writing the rationale for firing FBI Director James Comey.

Deputy Attorney General Rod Rosenstein argued the case for Comey’s sacking in a three-page memo to Attorney General Jeff Sessions on Tuesday. President Donald Trump acted swiftly to dismiss the director later that day.

Rosenstein cited Comey’s controversial public statements about the bureau’s investigation into Democratic presidential candidate Hillary Clinton’s use of a private email server while she was secretary of state.

“It is a textbook example of what federal prosecutors and agents are taught not to do,” Rosenstein wrote of Comey’s public comments.

Spokespeople for the Department of Justice and the FBI did not return calls seeking comment late Tuesday.

Comey’s firing will likely be seen as further evidence of Washington’s hyper-partisan upheaval. Rosenstein has drawn fire from Democrats who allege political motives in the White House decision to dismiss Comey - and particularly, its timing.

“Why did it happen today?” asked Senate Democratic Minority Leader Chuck Schumer, of New York. “We know the FBI has been looking into whether the Trump campaign colluded with the Russians ... Were those investigations getting too close to home for the President?”

The rationale for canning Comey, however, came from a 26-year Justice Department veteran who is widely viewed by his peers and many lawmakers as uncommonly nonpartisan.

Named as Maryland’s top prosecutor by President George W. Bush, Rosenstein stayed in office through the Obama administration.

Rosenstein was the longest-serving U.S. attorney when he was nominated by Trump last January.

When he was confirmed by the Senate, he enjoyed overwhelming bipartisan support - a 94-to-6 vote - despite the deeply divided culture of today’s Washington.

Bonnie Greenberg, a federal prosecutor in Maryland told Reuters in March that Rosenstein was admired as a rare career prosecutor who could insulate himself from political pressure.

“He only does something if he thinks it’s right,” said Greenberg, who worked with Rosenstein for 11 years.

Many in the Justice Department saw Rosenstein’s appointment as a counter-balance to the extreme partisanship surrounding accusations of Russian interference in last year’s election. And he was immediately swept into that fray.

Before Rosenstein was confirmed for the position by the U.S. Senate, some Democratic lawmakers asked him to pledge he would appoint a special independent prosecutor to investigate allegations of collusion between the Trump campaign and Russian officials.

He was easily confirmed despite rebuffing those demands.

‘TEXTBOOK EXAMPLE’

Some Republicans have been angered by Comey’s public statements about the FBI investigation into possible ties between the Trump campaign and Russia.

But Rosenstein’s criticism of Comey focused on actions seen to have damaged Democratic candidate Clinton.

Rosenstein focused in particular on Comey’s news conference last July, when the director announced his conclusion that Clinton should not be prosecuted - while at the same time publicly bashing her use of a private email server for sensitive U.S. government business.

That day, Rosenstein wrote, Comey usurped the authority of the U.S. Attorney General - who has authority over whether prosecutions should proceed, based on the quality of FBI investigations.

Comey also violated longstanding practice by “gratuitously” releasing damaging information about Clinton - even as he acknowledged the evidence against her was insufficient to warrant continued investigation, Rosenstein wrote.

“We do not hold press conferences to release derogatory information about the subject of a declined criminal investigation,” Rosenstein wrote, adding that Comey “laid out his version of the facts for the news media as if it were a closing argument, but without a trial.”

A UNIFYING ISSUE

U.S. Senator Mark Warner of Virginia, the top Democrat on the Senate Intelligence Committee, said the timing of Comey’s firing was suspect - coming so long after the election of Trump and Comey’s alleged mishandling of the case.

He directly criticized Rosenstein.

“I am very disappointed with this deputy attorney general, who I was told had a good reputation,“ he said. ”But signing this letter saying that he recommends firing Comey because of Comey’s actions with Hillary Clinton nine months ago, or 10 months ago? That doesn’t pass any smell test.”

Rosenstein, in his letter, cited broad, bipartisan agreement on Comey’s errors in judgment.

Last summer, Comey defended his decision to speak publicly about the Clinton investigation, saying “the American people deserve those details in a case of intense public interest.”

Last week, before a Senate committee, Comey defended his decision in October - two weeks before the presidential election - to publicly announce the bureau had discovered new emails that might be related to the closed investigation into Clinton.

“To not speak about it would require an act of concealment in my view,” Comey said.

Rosenstein wrote that he was perplexed at Comey’s continued defenses of his handling of the probe.

“I do not understand his refusal to accept the nearly universal judgment that he was mistaken,” Rosenstein wrote. “It is one of the few issues that unites people of diverse perspectives.”