Apple has instituted two-factor authentication on iCloud in response to the leaking of naked celebrity pictures earlier this month.

If enabled users of the cloud service will be asked to enter a passcode sent to their phone before they can access their accounts, though the change is optional.

An email sent to iCloud customers said: "Starting today, in addition to protecting your Apple ID account information, two-step verification also protects all of the data you store and keep up to date with iCloud."

At the time of the celebrity photo leak two-factor security was not extended to all iCloud services, leaving access to file backups protected only by passwords and security questions.

It is still unknown just how the accounts were accessed, though many experts have guessed that brute force attacks in which hackers repeatedly guess passwords may have been to blame, while others have argued that phishing scams or specialist software were used.

Shortly after the leaks Apple chief executive Tim Cook said the firm would send alerts to customers if it noticed a new device was being used to access their iCloud accounts or change their password.

Apple added: "If you use iCloud with any third party apps such as Microsoft Outlook, Mozilla Thunderbird, or BusyCal, you can now generate app-specific passwords that allow you to sign in securely even if the app you are using does not support two-step verification."

It said customers would be required to use such passwords from October 1.