Microsoft has been fined €561m by the European commission for failing to give users a choice of web browser when they logged into Windows computers in Europe between May 2011 and July 2012 – breaking a binding commitment it had made in 2009.

The error arose when Microsoft's own programmers forgot to include a single line of code that would have automatically triggered the "browser choice" program on versions of Windows 7 running its first major update, called Service Pack 1 (SP1).

A source close to Microsoft explained: "It was a single line in the code that triggered the browser choice program. It had a list of versions of Windows to test against: if the version was found in that list, the program would run. They didn't include Service Pack 1, which is effectively a different version of Windows, in that list. And so the program didn't run."

That meant that an estimated 15 million users were not presented with the alternatives such as Google's Chrome, Mozilla's Firefox, Apple's Safari, Opera and other browsers.

The fine works out to about €37.40 per user affected, or more than €1.3m per day. But Microsoft could have been fined as much as 10% of its fiscal 2012 revenues - equivalent to €5.9bn. The fine on Wednesday, though large, is substantially less than that.

The two sides have given varying estimates of the time and number of users affected: Microsoft suggested it was 28 million people, between February 2011 and July 2012; the European commission, in announcing the fine, put it at 15m and with a starting date of May 2011.

Microsoft made a five-year commitment in 2009 to offer users a choice of different browsers, after the EC's competition commission determined that the combination of its dominance on the desktop – where Windows runs around 95% of machines – gave the pre-installed Internet Explorer browser an unfair advantage over rivals. At the time that negotiations first began, in the early 2000s, IE had a share of over 80% among browsers.

The commission implemented the "browser choice" system to create a level playing field - and said that once in use, it was very effective: "The choice screen was very successful with users," Joaquín Almunia, the competition commissioner, said in a statement. "For example, until November 2010, 84 million browsers were downloaded through it."

It was Microsoft itself which realised that it was not complying with the directive after the release of SP1, a major update to Windows 7 released in February 2011. On discovering the error in July 2012, it got in touch with the EC's competition arm to admit the error.

The penalty is the first time that the EC has had to fine a company for failing to comply with a so-called "commitments decision". It said that the size of the fine had been calculated by considering "the gravity and duration of the infringement, the need to ensure a deterrent effect of the fine and, as a mitigating circumstance, the fact that Microsoft has cooperated with the commission and provided information which helped the commission to investigate the matter efficiently."

Microsoft said it took "full responsibility" for the technical error that caused the problem and that it had apologised for it.

The company added: "We provided the commission with a complete and candid assessment of the situation, and we have taken steps to strengthen our software development and other processes to help avoid this mistake – or anything similar – in the future."