Yes! you can freely jailbreak your iPhone. EFF (Electronic Frontier Foundation) won a landmark case in the U.S.
"In its reasoning in favor of EFF's jailbreaking exemption, the Copyright Office rejected Apple's claim that copyright law prevents people from installing unapproved programs on iPhones: "When one jailbreaks a smartphone in order to make the operating system on that phone interoperable with an independently created application that has not been approved by the maker of the smartphone or the maker of its operating system, the modifications that are made purely for the purpose of such interoperability are fair uses.""
I am not lawyer but it should be legal in any other country as apple is an U.S. company