We introduce a previously unreported laser cavity configuration, using a diffractive optical element (DOE) in place of the output coupler. Such a configuration allows the DOE to work both in reflection, as a mode shaping element, and in transmission as a beam shaper. Employing dual wavelength DOE optimization techniques and phase delays greater than 2p, allows the two functions to be designed independently. Thus, an arbitrary output beam profile can be combined with a mode shape which maximizes energy extraction from the gain medium. Devices are designed and their performance modeled for a 1m cavity with 5mm diameter mirrors and a wavelength of 632.8nm. An element with 32 quantization levels and a maximum phase delay of 8p in transmission produces high quality results. © 2007 Optical Society of America.