The global fit of the Standard Model to electroweak precision data, routinely performed by the LEP electroweak working group and others, demonstrated impressively the predictive power of electroweak unification and quantum loop corrections. We have revisited this fit in view of (i) the development of the new generic fitting package Gfitter, (ii) the insertion of constraints from direct Higgs searches at LEP and the Tevatron, and (iii) a more thorough statistical interpretation of the results. Gfitter is a modular fitting toolkit, which features predictive theoretical models as independent plugins, and a statistical analysis of the fit results using toy Monte Carlo techniques. The state-of-the-art electroweak Standard Model is fully implemented, as well as generic extensions to it. This paper introduces the Gfitter project, and presents state-of-the-art results for the global electroweak fit in the Standard Model, and for a model with an extended Higgs sector (2HDM). Numerical and graphical results for fits with and without including the constraints from the direct Higgs searches at LEP and Tevatron are given. Perspectives for future colliders are analysed and discussed. Including the direct Higgs searches, we find M_H=(116.4 +18.3 -1.3) GeV, and the 2sigma and 3sigma allowed regions [114,145] GeV and [[113,168] and [180,225]] GeV, respectively. For the strong coupling strength at fourth perturbative order we obtain alpha_S(M_Z)=0.1193 +0.0028 -0.0027(exp) +- 0.0001(theo). Finally, for the mass of the top quark, excluding the direct measurements, we find m_t=(178.2 +9.8 -4.2) GeV. In the 2HDM we exclude a charged-Higgs mass below 240 GeV at 95% confidence level. This limit increases towards larger tan(beta), where e.g., M_H+-<780 GeV is excluded for tan(beta)=70.