In a near unanimous vote, the European Parliament has rejected the controversial Software Patents Directive.
Rejection means that companies and software developers can continue to register patents, but protection will not be guaranteed across the EU.
"This represents a clear victory for open source," said Simon Phipps, chief open source officer at Sun Microsystems. "It expresses Parliament's clear desire to provide a balanced competitive market for software."
Dr John Collins, a partner at US law firm Marks and Clark, said: "The directive was intended to harmonise the differing interpretations of patent law concerning software inventions, but those opposed to it lobbied so intensely that it had so many amendments that rejection was the only alternative.
"The rejection means there remains no formal harmonisation across the European Union on patent law.
"The open source lobby will try to claim victory and say that this vote is a defeat for software patents, yet software will continue to be patented in Europe as it has for the past 30 years."
The directive had been hotly debated for over a year with big tech vendors such as Nokia and Siemens in support.
But it was strongly opposed by smaller developers and the likes of Red Hat, Oracle, Fujitsu, Yahoo and Sun, which had claimed that approving the directive "would be a disaster for small developers, and result in the 'Americanisation' of the European patent system".
Small tech firms generally want a patent to cover only the invention running a program, which then allows others to use the software.
Most experts see it as a delicate balance between providing legal protection to software innovators, while not setting up barriers that stifle new development.
The directive is formally known as the Computer-implemented Inventions Directive.
Facebook told by Brussels-based court to stop tracking non-users and to delete all data held on them
Supply chain and manufacturing experience could give Dyson an important edge
New VR Zone Portal arcades open in London and Tunbridge Wells
Systems-on-a-chip with integrated AI features could make voice and facial recognition