Lionel Messi has left Barcelona in turmoil by agreeing to join Real Madrid at the end of the season in a record-breaking five-year deal that will be worth around half a billion euros.