20 pages, 22 figures, accepted by A&A. Minor corrections plus an extended discussion of the galaxy stellar mass function. Galaxy number counts are also updated (Figs 10-12 and Table 3)International audienceWe present a new near-infrared imaging survey in the four CFHTLS deep fields: the WIRCam Deep Survey or "WIRDS". WIRDS comprises extremely deep, high quality (FWHM ~ 0.6″) J, H, and Ks imaging covering a total effective area of 2.1 deg2 and reaching AB 50% completeness limits of ≈ 24.5. We combine our images with the CFHTLS to create a unique eight-band ugrizJHKS photometric catalogues in the four CFHTLS deep fields; these four separate fields allow us to make a robust estimate of the effect of cosmic variance for all our measurements. We...