The Martins live in a quiet Brooklyn neighbourhood

New York's police chief has delivered a cheesecake to an elderly couple in Brooklyn, to apologise for dozens of mistaken police visits to their home.

A computer glitch had led officers to Walter and Rose Martin's home 50 times in the past eight years, police said.

The latest intrusion came on Tuesday, with officers pounding on the front and back doors, shouting "Police, open up!"

Thursday's visit - cheesecake in hand - went well. The Martins, aged 82 and 83, shared pictures of their grandchildren.

New York Police Commissioner Raymond Kelly visited the couple's modest home on Friday to "apologise and explain" for the mix-up, NYPD Deputy Commissioner Paul Browne told the Associated Press.

The problem started in 2002, when the Martin's home address was used as "test data" for a new computer crime-tracking system.

The couple complained about the harrowing visits in 2007, but the data remained in the system despite efforts to "purge the records", Deputy Commissioner Browne said.

He added that the Martin's address had now been flagged with alerts "barring officers" from questioning the octogenarians.