US tech giants Google and Microsoft have reached a truce with the Government and the creative industries in a bitter and long-running battle over links to pirated films and music online.

The search engine operators have signed up to a clampdown that will see the UK’s copyright watchdog monitor the search results they provide for unlawful websites.

The agreement follows years of campaigning by record labels and film studios, which have accused Google and Microsoft of turning a blind eye to piracy and dragging their feet over measures to protect copyright online.

Jo Johnson, the minister for universities, science, research and innovation, said that the search engines' "relationships with our world leading creative industries needs to be collaborative".

"It is essential that [consumers] are presented with links to legitimate websites and services, not provided with links to pirate sites," he said.

Under a new voluntary code, the tech giants have committed to demote websites that have repeatedly been served with copyright infringement notices, so that they do not appear on the first page for common searches. Search engine autocomplete functions, a time-saving feature that suggests what users may be looking for, should also remove terms that may lead to pirate websites rather than legitimate services that pay fees to copyright holders.