Let and be integers such that , and let be a graph of order with and the minimum degree . Let and be two nonnegative integer-valued functions defined on such that for each . We prove that if for any two nonadjacent vertices and in , then has a -factor. Furthermore, it is shown that the result in this paper is best possible in some sense.