We report on our computation of the leading hadronic contribution to the anomalous magnetic moment of the muon using two dynamical flavours of non-perturbatively O(a) improved Wilson fermions. The strange quark is introduced in the quenched approximation. Partially twisted boundary conditions are applied to improve the momentum resolution in the relevant integral. Our results, obtained at three different values of the lattice spacing, allow for a preliminary study of discretization effects. We explore a wide range of lattice volumes, namely 2 fm <L <3 fm, with pion masses from 600 to 280 MeV and discuss different chiral extrapolations to the physical point. We observe a non-trivial dependence of a_mu(HLO) on m_pi especially for small pion masses. The final result, a_mu(HLO)=618(64)*10^(-10), is obtained by considering only the quark connected contribution to the vacuum polarization. We present a detailed analysis of systematic errors and discuss how they can be reduced in future simulations.