One of the attackers was also shot dead on Wednesday as he opened fire near a group of people entering the district jail to visit relatives.
Indian police believe the attackers opened fire on a security picket and threw grenades in an attempt to enter the jail.
But security officials at the entrance returned fire and television reports showed the body of one lying outside the prison entrance in a pool of blood.
Ten people were injured during the raid, five of them policemen.
Police do not know how many attackers were involved in the incident.
The attack follows comments by the head of Kashmir's main Islamist alliance, which called on voters to boycott upcoming Indian parliamentary elections.
Speaking to the Greater Kashmir newspaper on Tuesday, the chairman of United Jihad Council (UJC), Sayyid Salah al-Din, said: "History won't forget or forgive those who yield to force or greed and participate in the elections."
"I am hopeful my people will show regard to martyrs' blood and keep distance from Indian puppets and their associates … we are fighting for their liberation and not for gaining petty favours"
Sayyid Salah al-Din,
chairman of United Jihad Council
Claiming elections under Indian rule are no solution to the Kashmir problem, Salah al-Din appealed to Kashmiris to abstain from voting in the poll, which will be held in four phases from 20 April.
"I am hopeful my people will show regard to martyrs' blood and keep distance from Indian puppets and their associates … we are fighting for their liberation and not for gaining petty favours."
Salah al-Din is also the supreme commander of Hizb al-Mujahidin which is among a dozen rebel groups that form the UJC – based in Pakistani-administered Kashmir.
Hizb al-Mujahidin has been active in Kashmir since 1989 when independence groups launched an insurgency against Indian rule in Kashmir.
Both factions of the region's main separatist political alliance, the All Parties Hurriyat Conference, have opposed the staging of the election in Kashmir, where there are six parliamentary constituencies.
More than 40,000 people have died in Kashmir since the eruption of an insurgency against Indian rule in Kashmir, according to official figures.
Separatists put the toll between 80,000 and 100,000.