The variational framework for linear electric circuits introduced in [1] is extended to general nonlinear circuits. Based on a constrained Lagrangian formulation that takes the basic circuit laws into account the equations of motion of a nonlinear electric circuit are derived. The resulting differential-algebraic system can be reduced by performing the variational principle on a reduced space and regularity conditions for the reduced Lagrangian are presented. A variational integrator for the structure-preserving simulation of nonlinear electric circuits is derived and demonstrated by numerical examples.We introduce an electric circuit as a connected, directed graph G with n edges and m + 1 nodes (and n − m meshes for planar graphs) containing n L inductors, n C capacitors, n R resistors, and n S voltage sources (n = n L + n C + n R + n S ). To each of these components we assign real-valued, time-dependent charges q(t), currents v(t), voltages u(t) and a magnetic flux ϕ, u). Each device has an assumed current flow direction. Furthermore, let K ∈ R n,m and K 2 ∈ R n,n−m be the Kirchhoff Constraint matrix and the Fundamental Loop matrix of a given circuit. The Kirchhoff current and voltage constraints are given as K T v = 0 (or K 2ṽ = v with the mesh currentsṽ) and K T 2 u = 0 (or Kû = u with the node voltagesû). Note that ker(K T 2 ) = im(K). The Lagrangian of an electric circuit with n C capacitors and n L inductors is given by the difference between magnetic and electric energy asj=1 q C j 0 f Cj (y) dy with the nonlinear inductor relationsϕ Lj = f Lj (v Lj ) and capacitor relations u Cj = f Cj (q Cj ). Note that L is independent from the currents across all non-inductor elements. Therefore, the Legendre transform FL(q, v) = q, ∂L ∂v (q, v) = (q, ϕ) is clearly degenerate as no relation between the artificial fluxes ϕ C,R,S and the existing currents v C,R,S is provided. The resistors (with relation u R = f R (v R )) and voltage sources u S = f S (v S , t) are incorporated in the Lagrangian force given byTo reduce the system's dimension, we define the Lagrangian and the forces on the space of meshes (following [1, 2]) asf Cj (y) dy with the Legendre transform FL M (q,ṽ) = (q, K T 2,L f L (K 2,Lṽ )) = (q,φ). Accordingly, we define the reduced Lagrangian force asDefining the mesh fluxesφ = K T 2 ϕ ∈ R n−m we can derive the equations of motion for the nonlinear circuit with the Lagrange-d'Alembert principle [1,3], i.e. we are searching for curvesq(t),ṽ(t) andφ(t) satisfyingFixing the initial and final points forq(0),q(T ) and taking variations δq, δṽ, δφ gives the implicit Euler-Lagrange equations on the mesh space ∂L M ∂q + f M L −φ = 0,q =ṽ, ∂L M ∂ṽ −φ = 0 which read for the nonlinear circuit aṡWhile the Lagrangian L with its Legendre transform FL is degenerate if any other components beside inductors are involved in the circuit, the reduction to L M can cancel out this degeneracy iff K T 2,L f L (K 2,L ·) : R n−m → R n−m is (locally) invertible. The following theorem extends the result in [1] for linear to nonlinea...