It was found inside a suspicious vehicle which was left in the Parkmore Close area of the Co Antrim town in the early hours of Sunday morning.
Army bomb squad officers were called to the scene and carried out a number of controlled explosions before removing the firearm and other items for further tests.
Residents who were evacuated from their homes overnight have now been allowed to return.
Superintendent John Magill said: "I would like to thank to local residents and the wider community in the area for their patience and support throughout this protracted operation.
"I wish to reassure them that this was necessary to ensure the safety of the local community and to protect everyone. Public safety is of paramount importance and the blame must lie with those who left this car in a residential area of the town."
The car at the centre of the alert - a silver coloured Mercedes car, registration number JHZ 5122 - was reported to police at around 1pm on Sunday.
It had been left there earlier that morning.
Parkmore Close, Parkmore Drive, Parkmore Heights, Upper Princes Street and the Cullybackey Road were all closed to traffic at the height of the security operation.
Local councillor Declan O'Loan said it caused massive disruption for dozens of families who were only allowed to return to the quiet residential area on Monday morning.
The SDLP man added: "The residents of over 30 houses within a 200m radius had to leave their homes and for them it was extremely disruptive and frightening. Initially they were told it was only for two hours but it turned out they were out of their homes overnight.
"I would congratulate Ballymena Council, the PSNI and Social Services for excellent emergency arrangements for those evacuated from their homes."
Police are now working to piece together the movements of the suspicious vehicle.
Anyone who saw it last Friday night, or anyone who was in the Parkmore Crescent area in the early hours of Saturday and witnessed suspicious activity was asked to call 0845 600 8000.