We study the restricted category O for an affine Kac--Moody algebra at the
critical level. In particular, we prove the first part of the Feigin-Frenkel
conjecture: the linkage principle for restricted Verma modules. Moreover, we
prove a version of the BGGH-reciprocity principle and we determine the block
decomposition of the restricted category O. For the proofs we need a deformed
version of the classical structures, so we mostly work in a relative setting.Comment: 25 pages, substantially revised version, closing a gap in the earlier
version