Three people were wounded, one critically, when a gunman opened fire at a Florida university library and was shot dead by police early on Thursday, officials said.

Officers confronted the attacker outside Florida State University's Strozier Library soon after midnight, ordered him to drop his weapon, then shot him when he fired on them, Tallahassee police said.

Three people were wounded, police spokesman David Northway told reporters, without giving further details. Officials at Tallahassee Memorial HealthCare hospital said two victims were being treated for gunshot wounds.

One of them was in critical condition, and the other was stable, a spokeswoman added.