For a given simple graph G, the energy of G, denoted by E(G), is defined as the sum of the absolute values of all eigenvalues of its adjacency matrix. Let Pnℓ be the unicyclic graph obtained by connecting a vertex of Cℓ with a leaf of Pn−ℓ. In [G. Caporossi, D. Cvetković, I. Gutman, P. Hansen, Variable neighborhood search for extremal graphs. 2. Finding graphs with extremal energy, J. Chem. Inf. Comput. Sci. 39 (1999) 984–996], Caporossi et al. conjectured that the unicyclic graph with maximal energy is Cn if n≤7 and n=9,10,11,13,15, and Pn6 for all other values of n. In this paper, by employing the Coulson integral formula and some knowledge of real analysis, especially by using certain combinatorial techniques, we completely solve this conjecture. However, it turns out that for n=4 the conjecture is not true, and P43 should be the unicyclic graph with maximal energy.