Ontario Provincial Police say an armed standoff near an army base that lasted almost 40 hours has ended peacefully after a man turned himself over to officers peacefully on Saturday afternoon.

Police said a 44-year-old man turned himself over just after noon ET in the town of Petawawa, about 160 kilometres northwest of Ottawa.

Police had cordoned off a residential neighbourhood and deployed the force's tactical response unit.

The police response began Thursday night before midnight and followed a visit by military police to a house in Petawawa, home of the army's 2 Canadian Mechanized Brigade Group.

Military officials confirmed Friday that military police were at the house Thursday night until the OPP arrived.

Typically, military police only respond when incidents happen on a military base or off-base and involve soldiers. Neighbours told CBC News the people who live in the house are a military couple.

Neighbours who live on the same street as the house were asked to stay inside and to keep their children off the streets. Those who left their homes weren't allowed back inside until the standoff ended.

The OPP said there was never a concern for the public, however.

Still, neighbours said the police response Thursday night was substantial and included heavily armed officers and police dog teams.

Police officers from as far away as Hawkesbury, Ont., about 250 kilometres away, responded to the standoff.