Following the seminal paper by Bourgain, Brezis, and Mironescu, we focus on the asymptotic behaviour of some nonlocal functionals that, for each $u\in L^2(\mathbb {R}^N)$, are defined as the double integrals of weighted, squared difference quotients of $u$. Given a family of weights $\{\rho _{\varepsilon} \}$, $\varepsilon \in (0,\,1)$, we devise sufficient and necessary conditions on $\{\rho _{\varepsilon} \}$ for the associated nonlocal functionals to converge as $\varepsilon \to 0$ to a variant of the Dirichlet integral. Finally, some comparison between our result and the existing literature is provided.