ISLAMABAD, Pakistan (CNN) -- Heavily armed militants put up a fierce fight on Tuesday to protect a Taliban stronghold in South Waziristan, Pakistan's military said.
Displaced Pakistanis wait in line Monday after fleeing military operations against militants in South Waziristan.
Taliban fighters attacked incoming troops in the village of Kotkai, using rocket launchers and heavy anti-aircraft machine guns, said a senior military official.
More than 20 militants and four soldiers died, he said. Three soldiers were wounded.
Kotkai is the hometown of Taliban leader Hakimullah Mehsud and Taliban commander Kari Hussain.
In Tuesday's clashes, militants engaged troops in head-on fighting instead of using their usual guerrilla tactics, the senior military official said.
A day earlier, military officials said they had seized control of the area.
Last week, Pakistani troops launched a massive ground offensive backed by air power in South Waziristan, a refuge and a power base for insurgents operating in Pakistan and along the Pakistani-Afghan border. Watch as Pakistan's army says no peace deal will be possible »
The offensive comes after a wave of militant suicide attacks in Pakistan.
The latest surge of fighting could add 170,000 refugees to the existing 100,000, the United Nations warned Monday.
The existing 100,000 refugees -- forced by fighting from their homes in the districts of Dera Ismail Khan and Tank in the North West Frontier Province -- have been housed with host families, and no camps have been set up to accommodate more refugees in the districts, the U.N. Office for the Coordination of Humanitarian Affairs said.
The United Nations, working with nongovernment aid agencies, is distributing food and other aid to the refugees as well as girding to help the possible new wave of refugees.
Earlier this year, fighting between government troops and the Taliban in the North West Frontier Province displaced more than 2 million Pakistanis, the U.N. agency said. About 1.6 million have returned home.
Other violence raged in Khyber, another region in Pakistan's tribal territories. Security forces on Tuesday struck suspected insurgent hideouts, killing two militants, seizing two others, and discovering a huge stash of ammunition. In another incident, a militant who attacked troops with hand grenades was killed on the spot by soldiers. The actions were unrelated to the massive ground offensive in South Waziristan.
Journalist Nasir Habib and CNN's Reza Sayah contributed to this report.