A Japanese Communist Party lawmaker and railway enthusiast who briefly trespassed on railroad tracks to snap photos of an electric locomotive found himself on the wrong arm of the law.

Police accused the Upper House member of violating the railway operation law and referred his case to prosecutors, investigative sources said.

According to the case file dated Sept. 16, Taku Yamazoe entered the tracks of the Chichibu Railway in Nagatoro in Saitama Prefecture close to Tokyo without permission on the morning of Nov. 3 last year.

Yamazoe, 36, admitted he had erred when interviewed by The Asahi Shimbun on Sept. 19.

He said he did so simply to shoot photos of an electric diesel that was temporarily put on service that day.

“I believed I could pass it as there was what appeared to be a path apparently made by local people and a board was placed over a creek,” he said. “I passed it in just a second.”

As he was about to head home after leaving the site, a police officer warned Yamazoe that his action amounted to a violation of the minor offenses law.

Yamazoe acknowledged on his Twitter account on Sept. 18 that his case was now in the hands of prosecutors.

He was elected for the first time from a Tokyo constituency in the 2016 Upper House election.

On his official website, Yamazoe lists taking photos of trains and hiking as among his hobbies.