A criterion for cofiniteness of modules

Let A be a commutative noetherian ring, a be an ideal of A, m, n be non-negative integers and let M be an A-module such that Ext A (A/a, M) is finitely generated for all i ≤ m+n. We define a class Sn(a) of modules and we assume that H a(M) ∈ Sn(a) for all s ≤ m. We show that H a(M) is a-cofinite for all s ≤ m if either n = 1 or n ≥ 2 and Ext i A (A/a, H a (M)) is finitely generated for all 1 ≤ t ≤ n − 1, i ≤ t − 1 and s ≤ m. If A is a ring of dimension d and M ∈ Sn(a) for any ideal a of dimension ≤ d − 1, then we prove that M ∈ Sn(a) for any ideal a of A.