In several shape optimization problems one has to deal with cost functionals of the form ${\cal F}(\Omega)=F(\Omega)+kG(\Omega)$, where $F$ and $G$ are two shape functionals with a different monotonicity behavior and $\Omega$ varies in the class of domains with prescribed measure. In particular, the cost functional ${\cal F}(\Omega)$ is not monotone with respect to $\Omega$ and the existence of an optimal domain in general may fail. An interesting situation occurs when the functional $F(\Omega)$ is minimized by a ball, while the functional $G(\Omega)$ is maximized by a ball; several examples of this kind are present in the literature. We consider the particular case ${\cal F}(\Omega)=\lambda(\Omega)T^q(\Omega)$ where $\lambda(\Omega)$ is the first eigenvalue of the Dirichlet Laplacian, and $T(\Omega)$ is the so-called torsional rigidity; the interesting cases are $q$ small for the minimum problem and $q$ large for the maximum problem.