A vehicle on Route 3 in Liberty caught fire after the driver pulled over because of engine trouble.

The driver, a Fairfield man, exited the vehicle before a fire broke out in the engine compartment, state police said in a Facebook post.

The post said a state trooper was driving by as the fire started.

The driver of the vehicle was not hurt.