NEWINGTON, Conn. (AP) _ A state lottery accountant who returned from stress-related disability only last week gunned down three supervisors Friday, then chased down the lottery chief in the parking lot and killed him, too.

The man shot himself to death as police closed in.

The sound of gunfire sent dozens of terrified workers rushing to the doors, where security guards yelled for them to run for the woods nearby.

The gunman, Matthew Beck, 35, an eight-year lottery employee, put in about a half-hour of work Friday morning before opening fire.

``I saw him come in and hang up his coat,'' said Peter Donahue, who works in the accounting office. ``He didn't come in and just start blasting. He planned it.''

Master Sgt. Gregory Chelso of the state police said Beck had a pistol and ``lots of ammunition.''

Lottery president and chief executive Otho Brown, 54, joined the security guards in yelling for everyone to ``just get out and run,'' said Shannon O'Neill. Brown fled the building and Beck pursued him. When Brown stumbled after about 100 yards, Beck shot him to death.

``We all took off for the woods and that was it. We heard gunshots when we were halfway through the woods,'' said O'Neill, a field representative for the lottery. Others workers took refuge in another part of the building used by a paint distributor.

Also killed were Linda Mlynarczyk, 38, the lottery's chief financial officer and a former mayor of New Britain; Frederick Rubelmann III, 40, vice president of operations; and Michael Logan, 33, an information services manager.

``The whole state mourns this unexplained act of violence,'' said Gov. John G. Rowland.

A 45-year-old man suffered a head injury as he jumped onto a moving vehicle while trying to get out of Beck's way.

Beck had been demoted from accounting to data processing work last year and filed a grievance. He won and was awaiting back pay.

He took a medical leave for job-related stress in October, returning to work Feb. 25. Two days later, he met with his union steward and Ms. Mlynarczyk to discuss the delay in getting his back pay.

``Yes, he has been troubled, but I don't want to talk to you right now,'' said his father, Donald Beck.

There is no armed security at lottery headquarters, about 10 miles south of Hartford. About 115 state workers are employed there, but it was unclear how many were there at the time of the shooting.

Beck was so depressed at one point in January 1997 that someone called the police to his apartment in Cromwell. He was not home when police got there, and was found later at a friend's home, said Capt. Tom Roohr.

On Friday afternoon, state police searched a garage and a pickup truck at Beck's father's home in Ledyard. Police said Beck has a gun permit in that town.

A blue sticker on the front door reads: ``Warning: Trespassers will be shot. Survivors will be shot again.''