The US Navy has agreed to pay Microsoft at least $9m to help secure computers running Windows XP after it failed to replace the aged OS before support ended.

The deal will see Microsoft provide critical hotfixes and software patches for Windows XP, Office 2003, Exchange 2003 and Server 2003 for a maximum of three years.

The navy runs a number of "legacy applications" that require Windows XP, which it is in the process of replacing.

Microsoft discontinued support for Microsoft XP, Microsoft Office 2003, and Microsoft Exchange 2003 in April 2014 and will end support for Microsoft Server 2003 in July 2015.

The navy expects the deal will run until July 2016, but there are provisions for further work to be undertaken until June 2017 if necessary - in which case it would cost just under $31m. The new deal extends an earlier arrangement with Microsoft to support these systems.

Steven A. Davis, a space and naval warfare systems command spokesman, described why the joint Microsoft premier support services and Microsoft custom support services deal is necessary.

"Nearly all the networks and workstations afloat and ashore will benefit from the Microsoft Premier Support services and Microsoft Custom Support services for Windows XP, Office 2003, Exchange 2003 and Server 2003."

He added the deal would specifically help "maintain enterprise-wide Microsoft capabilities to ensure Navy warfighters have connectivity to their respective networks and to the data necessary to support and accomplish their mission".

In addition to providing patches, the deal also provides Microsoft support and training for tackling problems related to these Microsoft products.

More on Windows XP