Australia’s High Court unanimously upheld a decision Wednesday to fire a public servant who anonymously criticized the government's immigration policy on Twitter.

The ruling was handed down after a six-year court battle on whether the limits imposed by the country’s Public Service Code of Conduct, which demands civil servants appear to be politically impartial, unjustly oversteps the implied freedom of political communication in the Australian Constitution, the Australian Financial Review reported. The Australian Constitution does not explicitly protect freedom of expression.

SOUTH AUSTRALIA POLICE MANAGER OFFERS GIFT CARD TO OFFICER WHO ISSUES MOST TICKETS; OFFICIALS RETRACT OFFER

Michaela Banerji, a former employee of the Department of Immigration and Border Protection, was fired in 2013 after a department investigation found she had written tweets critical of the then-Labor government and her department while using a pseudonym.

Outside court Wednesday, Banerji said that she pursued the case "to affirm the role of this freedom of speech for public servants and we failed."

"It's not just a loss for me, it's a loss for all of us and I'm very, very, very sorry," she told reporters.

Banerji wrote more than 9,000 posts using the Twitter handle “LaLegale” over six years during her employment with the Department of Immigration and Border Protection, now part of the Department of Home Affairs. The tweets were sent from her personal phone on her own time.

High Court Justice Stephen Gageler said the court focused on the appearance of impartiality rather than its actual observance, the Financial Review reported.

"Confidence cannot exist without trust, and trust cannot exist without assurance that partisan political positions incapable of being communicated with attribution will not be communicated anyhow under the cloak of anonymity," Gageler said.

But officials with the Community and Public Sector Union, which represents public servants, called the decision “Orwellian censorship.” The union said the decision had serious implications for free speech and could potentially affect almost 2 million Australians who work for the federal, state and local governments.

CLICK HERE FOR THE FOX NEWS APP

Banerji’s lawyer, Allan Anforth, told reporters after the hearing that the implications could extend to workers in the private sector who are critical of their employer’s political stance.

"The logic of it does not stop at the bounds of the public service," he said.

The Associated Press contributed to this report.