Illegal downloaders face a "three strikes and you're out" system under plans unveiled by Ofcom.

The communications watchdog's draft code is an attempt to crack down on online piracy and encourage internet users to download music and films legally.

Industry bodies will monitor file-sharing sites and pass on information on illegal downloaders to the biggest internet service providers (ISPs).

They will then write to customers informing them of allegations they have infringed copyright.

If customers get three or more letters within 12 months, copyright holders, such as record labels or film studios, can seek a court order allowing them to be identified so they can face legal action.

Creative Industries Minister Ed Vaizey said they had to be able to "protect their investment".

He said: "They have the right to charge people to access their content if they wish, whether in the physical world or on the internet.

"We are putting in place a system to educate people about copyright to ensure they know what legitimate content is and where to find it."

Claudio Pollack, Ofcom's consumer group director, said: "These measures are designed to foster investment and innovation in the UK's creative industries while ensuring internet users are treated fairly and given help to access lawful content.

"Ofcom will oversee a fair appeals process and also ensure that rights holders' investigations under the code are rigorous and transparent."

The code will initially cover ISPs with more than 400,000 broadband-enabled fixed lines - currently BT, Everything Everywhere, O2, Sky, TalkTalk Group and Virgin Media - which account for more than 93% of the retail broadband market in the UK.

Customers will be able to challenge allegations through an independent appeals body but it will cost £20, which is refundable if the appeal succeeds.

Mike O'Connor, chief executive of Consumer Focus, said the £20 fee could deter people on "low-incomes" from challenging an allegation.

He said: "Copyright infringement is not to be condoned but people who are innocent should not have to pay a fee to challenge accusations."