MEXICO CITY -- Four people were shot to death in the Mexican capital Saturday, just steps from an entrance to the official residence of the president, authorities said.

Officials said a man entered an apartment building near the National Palace seeking to urinate in the courtyard and was confronted by residents. He pulled out a gun and began shooting, hitting five people, officials said.

WIFE OF EX-CEO OF AMAZON MEXICO BEATEN BY HUSBAND BEFORE MURDER, IMAGES SHOW

A police officer killed the shooter, while three of the building residents died, authorities said. Two more residents were wounded.

The surrounding area was packed with holiday shoppers.

CLICK HERE TO GET THE FOX NEWS APP

Residents who declined to give their names said their street in the capital's historic center is far from safe, despite being a stone's throw from the National Palace. President Andres Manuel Lopez Obrador moved into the palace when he took office a year ago, turning the former presidential residence in Chapultepec Park into a museum.