  In this paper we investigate the existence of solutions to the following
Schr\"{o}dinger system in the critical case \begin{equation*} -\Delta
u_{i}+\lambda_{i}u_{i}=u_{i}\sum_{j = 1}^{d}\beta_{ij}u_{j}^{2} \text{ in }
\Omega, \quad u_i=0 \text{ on } \partial \Omega, \qquad i=1,...,d.
\end{equation*} Here, $\Omega\subset \mathbb{R}^{4}$ is a smooth bounded
domain, $d\geq 2$, $-\lambda_{1}(\Omega)<\lambda_{i}<0$ and $\beta_{ii}>0$ for
every $i$, $\beta_{ij}=\beta_{ji}$ for $i\neq j$, where $\lambda_{1}(\Omega)$
is the first eigenvalue of $-\Delta$ with Dirichlet boundary conditions. Under
the assumption that the components are divided into $m$ groups, and that
$\beta_{ij}\geq 0$ (cooperation) whenever components $i$ and $j$ belong to the
same group, while $\beta_{ij}<0$ or $\beta_{ij}$ is positive and small
(competition or weak cooperation) for components $i$ and $j$ belonging to
different groups, we establish the existence of nonnegative solutions with $m$
nontrivial components, as well as classification results. Moreover, under
additional assumptions on $\beta_{ij}$, we establish existence of least energy
positive solutions in the case of mixed cooperation and competition. The proof
is done by induction on the number of groups, and requires new estimates
comparing energy levels of the system with those of appropriate sub-systems. In
the case $\Omega=\mathbb{R}^4$ and $\lambda_1=\ldots=\lambda_m=0$, we present
new nonexistence results. This paper can be seen as the counterpart of
[Soave-Tavares, J. Differential Equations 261 (2016), 505-537] in the critical
case, while extending and improving some results from [Chen-Zou, Arch. Ration.
Mech. Anal. 205 (2012), 515--551], [Guo-Luo-Zou, Nonlinearity 31 (2018),
314--339].
