Security forces cordoned off Gursoo area in Pulwama district last evening following information about presence of militants in the area, a police official said.
He said the security forces launched house to house searches in order to flush out the militants.
"At around 3 AM, the militants tried to escape from the house where they were hiding. They were challenged by the security forces and asked to surrender," the official said.
He said the militants opened firing on the security force who retaliated, resulting in the death of the two ultras.
The identity of the other militant, believed to be a foreigner, was being ascertained, the official said.
Both the militants were affiliated with Lashkar-e-Toiba outfit, the official said adding, two AK rifles were recovered from the scene of the gunbattle.