JOHANNESBURG — A South African farmer whose vineyard in the Stellenbosch wine region had been occupied by shack dwellers since last year has been shot and killed in his home, heightening tensions amid a contentious national debate over the ownership of land.

Four men entered the house of the farmer, Stefan Smit, on Sunday evening before killing him, said Lt. Col. Andre Traut, a police spokesman. Mr. Smit’s home is about 30 miles east of Cape Town, in South Africa’s most famous wine region. Mr. Smit’s wife and a family friend were both present during the attack and survived, Colonel Traut said, adding that the suspects fled with personal belongings.

But it was too soon to say whether the killing was related to the dispute over land or was a random criminal act.

The killing of Mr. Smit, 62, a prominent white farmer whose family has grown grapes for generations, immediately drew strong reactions from groups representing white farmers and white-minority rights.