How will the earth be cleansed by fire? (LDS perspective) I'm preparing for a Sunday School lesson that includes 3 Nephi 25 where Christ quotes Malachi 4.

1 For, behold, the day cometh, that shall burn as an oven; and all the proud, yea, and all that do wickedly, shall be stubble: and the day that cometh shall burn them up, saith the Lord of hosts, that it shall leave them neither root nor branch.

That verse is part of a prophecy that the earth will be cleansed when Christ returns. The cleansing is frequently described as fire, such as in the passage quoted above. How will this happen?
The verse I quoted has figurative language, so it could be assumed that the fire is figurative. But whenever this topic comes up in church, the discussion seems to imply that the burning will be literal with people occasionally going so far as speculating it will be caused by nuclear bombs (that is not doctrine of the LDS church).
The Gospel Principles manual also implies that it's a literal burning:

When Jesus Christ comes again to the earth, He will do the following things:

He will cleanse the earth. When Jesus comes again, He will come in power and great glory. At that time the wicked will be destroyed. All things that are corrupt will be burned, and the earth will be cleansed by fire (see D&amp;C 101:24–25).


So which is it? If it's figurative, do we know what the fire represents? If it's literal, do we know what will cause the fire? How will the righteous escape?
Fire is often symbolic of the purifying power of the Holy Ghost, and I wouldn't be surprised if the "burning" is both physical and spiritual in this case. For example, missionary work may be one way that the wicked are "burned" (cleansed) and are uprooted from their ways.