We prove a local-global principle for the problem of representations of quadratic forms by quadratic forms over ℤ, in codimension ≥5. The proof uses the ergodic theory of p-adic groups, together with a fairly general observation on the structure of orbits of an arithmetic group acting on integral points of a variety.