SYDNEY, Australia — A man set himself on fire after a standoff with the police near the Sydney offices of the Department of Immigration and Border Protection on Friday, the police said, unleashing screams and smoke and prompting a rapid rescue by firefighters and the police.

“Police made attempts to negotiate, however the man lit himself on fire,” the police said in a statement. “Police were ready with a fire extinguisher and extinguished the man.”

The police declined to identify the man or his nationality but said that it was an act of protest and that the man was not seriously hurt.

“He was protesting at the Immigration Department this afternoon,” Detective Superintendent David Donohue said at a news conference. He added that the man “is a person who suffers from mental illness.”