  We prove a conjecture of Kleinbock which gives a clear-cut classification of
all extremal affine subspaces of $\mathbb{R}^n$. We also give an essentially
complete classification of all Khintchine type affine subspaces, except for
some boundary cases within two logarithmic scales. More general Jarn\'ik type
theorems are proved as well, sometimes without the monotonicity of the
approximation function. These results follow as consequences of our novel
estimates for the number of rational points close to an affine subspace in
terms of diophantine properties of its defining matrix. Our main tool is the
multidimensional large sieve inequality and its dual form.
