A recently fired security guard, who opened fire and took dozens hostage at a shopping mall in the Philippines on Monday, has released his captives and walked out of the complex where he used to work, ending a daylong standoff, officials said.

The disgruntled ex-guard, identified as Archie Paray, left the V-Mall in suburban San Juan city in metropolitan Manila in the evening with his hostages, who were secured by police. The number of hostages was not immediately clear.

5-HOUR PRISON HOSTAGE STANDOFF IN IRELAND ENDS AFTER CANDY BAR EXCHANGE

The suspect was allowed to air his grievances against his former bosses to reporters and authorities before police took him into custody. He accused his superiors of corruption and abuse, and a police report said he was complaining of “unequal treatment.”

Former security guard Archie Paray, right, talks to media shortly after releasing all his hostages at the V-mall in Manila. (AP Photo/Aaron Favila)

Former security guard Archie Paray, right, talks to media shortly after releasing all his hostages at the V-mall in Manila. (AP Photo/Aaron Favila)

The hostage crisis began earlier that morning when the suspect rushed the second floor of the mall and took dozens of hostages inside an administrative office. Officials at the time believed 30 to 40 people, mostly employees, were being held based on the size of the office.

Mayor Francis Zamora of San Juan said the suspect was a disgruntled former security guard at the complex. He was wielding a pistol and shot one person, whom police later identified as a security officer, before rushing the second floor. The victim was in stable condition at a nearby hospital, Zamora said.

Hostages walk out of the V-Mall in Manila after a former security guard held them at gunpoint inside an office, officials said. (AP Photo/Aaron Favila)

Hostages walk out of the V-Mall in Manila after a former security guard held them at gunpoint inside an office, officials said. (AP Photo/Aaron Favila)

“He felt bad because he was removed as a guard,” Zamora told reporters, adding that the man tried but failed to convince fellow guards to join him.

The suspect was apparently dismissed from work after abandoning his job in recent weeks without notifying management, Zamora said. He said the hostages were fine and added that authorities were trying to resolve the situation without further violence.

5 MILWAUKEE SHOOTING VICTIMS IDENTIFIED, SUSPECTED GUNMAN WAS 17-YEAR ELECTRICIAN AT BREWERY

In a bid to appease the hostage-taker, six officers in charge of overseeing the mall's security apologized to the suspect at an early evening news conference for their “shortcomings” and resigned or offered to quit.

Philippine police on Monday surrounded the shopping mall in an upscale section of Manila after a recently dismissed security guard opened fire and took dozens of people hostage, an official said. (AP Photo/Aaron Favila)

Philippine police on Monday surrounded the shopping mall in an upscale section of Manila after a recently dismissed security guard opened fire and took dozens of people hostage, an official said. (AP Photo/Aaron Favila)

“I’m asking for his forgiveness, and because of this, I’ll resign from my job so this crisis will come to an end,” said Oscar Hernandez, one of the security officers.

CLICK HERE FOR THE FOX NEWS APP

At the height of the crisis, more than a dozen SWAT commandos were seen entering the mall, their assault rifles ready. Other policemen stood by outside, along with an ambulance.

The Associated Press contributed to this report.