The parameters of the electroweak theory are determined in a combined electroweak and QCD analysis using all deep-inelastic $e^+p$ and $e^-p$ neutral current and charged current scattering cross sections published by the H1 Collaboration, including data with longitudinally polarised lepton beams. Various fits to Standard Model parameters in the on-shell scheme are performed. The mass of the $W$ boson is determined as $m(W)=80.520pm 0.115$ GeV. The axial-vector and vector couplings of the light quarks to the $Z$ boson are also determined. Both results improve the precision of previous H1 determinations based on HERA-I data by about a factor of two. Possible scale dependence of the weak coupling parameters in both neutral and charged current interactions beyond the Standard Model is also studied. All results are found to be consistent with the Standard Model expectations.