Hong Kong CNN Business  — 

Facebook will restore news pages in Australia after the government agreed on changes to a planned media code that the company said would allow it to retain greater control over what appears on its platform.

The announcement caps months of bitter dispute between the American tech firm and Canberra, which had been working on legislation that would force tech platforms to pay publishers for news content.

The initial version of the legislation would have allowed media outlets to bargain either individually or collectively with Facebook and Google (GOOGL) — and to enter binding arbitration if the parties couldn’t reach an agreement.

On Tuesday, the Australian government said it would amend the code to include a provision that “must take into account whether a digital platform has made a significant contribution to the sustainability of the Australian news industry through reaching commercial agreements with news media businesses.”

Arbitration, meanwhile, will now only be used as a “last resort” following a period of “good faith” mediation.

“The government has clarified we will retain the ability to decide if news appears on Facebook so that we won’t automatically be subject to a forced negotiation,” Campbell Brown, Facebook’s vice president for global news partnerships, said in a statement.

She said the agreement “will allow us to support the publishers we choose to, including small and local publishers,” adding that the company was “restoring news on Facebook in Australia in the coming days.”

Last week, Facebook (FB) barred Australians from finding or sharing news on its service. The decision — which appeared to be the most restrictive move the company has ever taken against content publishers — forced the pages of media organizations and even some unrelated essential services to go dark.

Facebook’s decision to restore news came as the Australian Senate discussed the latest iteration of the media law.

“It’s always been our intention to support journalism in Australia and around the world, and we’ll continue to invest in news globally, and resist efforts by media conglomerates to advance regulatory frameworks that do not take account of the true value exchange between publishers and platforms like Facebook,” Brown said.

Google, meanwhile, had already been trying to get ahead of the new legislation by announcing partnerships with some of the country’s largest media organizations, including Rupert Murdoch’s News Corp (NWS) and Seven West Media. Facebook revealed its own deal with Seven on Tuesday.

Asked about Google’s partnerships last week, Australian Treasurer Josh Frydenberg alluded to the changes that were ultimately announced Tuesday. He said that “if commercial deals are in place, then it changes the equation.”

— Kerry Flynn contributed to this report.