(1) In an action for a violation of chs. 5 to 12, subch. III of ch. 13, or subch. III of ch. 19, or for a violation of any other law arising from or in relation to the official functions of the subject of the investigation or any matter that involves elections, ethics, or lobbying regulation under chs. 5 to 12, subch. III of ch. 13, or subch. III of ch. 19, a defendant who is a resident of this state may move to change the place of trial to the county where the offense was committed. The motion shall be in writing.(2) The court shall grant a motion under this section if the court determines that the county where the offense was committed is different than the county where the defendant resides. If there is more than one county where the offense was committed, the court shall determine which of the counties where the offense was committed will be the place of trial. The judge who orders the change in the place of trial shall preside at the trial and the jury shall be chosen from the county where the trial will be held. Preliminary matters prior to trial may be conducted in either county at the discretion of the court. The judge shall determine where the record shall be kept and, if the defendant is in custody, where the defendant shall be held.(3) This section does not affect which prosecutor has responsibility under s. 978.05(1) to prosecute criminal actions arising from violations under sub. (1).(4) This section does not affect the application of s. 971.22. In actions under sub. (1), the court may enter an order under s. 971.225 only if the order is agreed to by the defendant.