We completely integrate the magnetic geodesic flow on a flat two-torus with the magnetic field $F = cos (x) dx wedge dy$ and describe all contractible periodic magnetic geodesics. It is shown that there are no such geodesics for energy $E geq 1/2$, for $E< 1/2$ simple periodic magnetic geodesics form two $S^1$-families for which the (fixed energy) action functional is positive and therefore there are no periodic magnetic geodesics for which the action functional is negative.