Let G be a connected graph of order n and let k be a positive integer with kn even and n≥8k2+12k+6. We show that if δ(G)≥k and max{d(u),d(v)}≥n/2 for each pair of vertices u,v at distance two, then G has a k-factor. Thereby a conjecture of Nishimura is answered in the affirmative.