We study the inflationary generation of helical cosmological magnetic fields in a higher-dimensional generalization of the electromagnetic theory . For this purpose , we also include a parity breaking piece to the electromagnetic action . The evolution of extra-dimensional scale factor allows the breaking of conformal invariance of the effective electromagnetic action in 1 + 3 dimensions required for such generation . Analytical solutions for the vector potential can be obtained in terms of Coulomb wave-functions for some special cases . We also present numerical solutions for the vector potential evolution in more general cases . In the presence of a higher-dimensional cosmological constant there exist solutions for the scale factors in which both normal and extra dimensional space either inflate or deflate simultaneously with the same rate . In such a scenario , with the number of extra dimensions D = 4 , a scale invariant spectrum of helical magnetic field is obtained . The net helicity arises , as one helical mode comes to dominate over the other at the superhorizon scales . A magnetic field strength of the order of 10 ^ { -9 } G can be obtained for the inflationary scale H \simeq 10 ^ { -3 } M _ { pl } . Weaker fields will be generated for lower scales of inflation . Magnetic fields generated in this model respects the bounds on magnetic fields by Planck and \gamma -ray observations ( i.e . 10 ^ { -16 } G < B _ { obs } < 3.4 \times 10 ^ { -9 } G ) .