New details are emerging about how a former B.C. baseball and hockey coach accused of secretly photographing children was caught by border guards following a trip to Bellingham, Wash.

Randy Downes spent decades coaching young athletes in Metro Vancouver.

He is now facing two counts of unlawfully observing or recording children under the age of 16 "where the children were in a place in which they could reasonably have been expected to be nude" in connection with incidents that allegedly occurred between June 1 and June 9, 2013 and Aug. 2 and Aug. 18, 2015.

According to testimony given in a New Westminster court Monday, a border services officer told the court Downes was selected for a secondary inspection at the Abbotsford-Huntingdon crossing in April of 2016.

According to the testimony, he told the officer he had been to Bellis Fair Mall and visited several stores, but only made a single purchase—something the officer told the court he wanted to verify.

The officer testified that he went looking for evidence of other receipts on Downes's cellphone when he came across several picture of a child inside a store taken from behind.

He told the court Downes's car also contained a laptop, memory cards and flash drives.

Border services officers testified that upon further examination of the electronics found inside the vehicle, they came across thousands of images. The first officer told the court most were of children playing sports, but there were other images they observed that appeared to show children inside locker rooms or change rooms. The second officer testified that none of the children in those images appeared to be looking at the camera.

The first officer told the court Downes claimed he had a sports photography business. According to the testimony, the officers submitted a reported to their intelligence division after Downes continued on his way. The file was also referred to the RCMP, which conducted a search warrant at Downes's Coquitlam home just over a month later and seized a large quantity of digital storage equipment.

There were pictures on the equipment that investigators believe Downes, who is a photographer, took himself between June 2013 and April 2016.

His trial is scheduled to last a week.

With files from CTV Vancouver's Maria Weisgarber