We investigate the inflation driven by a nonlinear electromagnetic field based on an NLED lagrangian density Lnled= - Ff(F) , where f(F) is a general function depending on F. We first formulate an f-NLED cosmological model with a more general function f(F) and show that all NLED models can be expressed in this framework; then, we investigate in detail two interesting examples of the function f(F) . We present our phenomenological model based on a new Lagrangian for NLED. Solutions to the field equations with the physical properties of the cosmological parameters are obtained. We show that the early Universe had no Big-Bang singularity, which accelerated in the past. We also investigate the qualitative implications of NLED by studying the inflationary parameters, like the slow-roll parameters, spectral index ns , and tensor-to-scalar ratio r, and compare our results with observational data. Detailed phase-space analysis of our NLED cosmological model is performed with and without matter source. As a first approach, we consider the motion of a particle of unit mass in an effective potential. Our systems correspond to fast-slow systems for physical values of the electromagnetic field and the energy densities at the end of inflation. We analyze a complementary system using Hubble-normalized variables to investigate the cosmological evolution before the matter-dominated Universe.