Consider an elliptic second order differential operator $L$ with no zeroth order term (for example the Laplacian $L=-\Delta$). If $Lu \leq 0$ in a domain $U$, then of course $u$ satisfies the maximum principle on every subdomain $V \subset U$. We prove a converse, namely that $Lu \leq 0$ on $U$ if on every subdomain $V$, the maximum principle is satisfied by $u+v$ whenever $v$ is a finite linear combination (with positive coefficients) of Green functions with poles outside $\overline{V}$. This extends a result of Crandall and Zhang for the Laplacian. We also treat the heat equation, improving Crandall and Wang's recent result. The general parabolic case remains open