The best way is just to revert the merge, by using git revert.
git help revert says:
  -m parent-number, --mainline parent-number
      Usually you cannot revert a merge because you do not know which side of the
      merge should be considered the mainline. This option specifies the parent
      number (starting from 1) of the mainline and allows revert to reverse the
      change relative to the specified parent.
      Reverting a merge commit declares that you will never want the tree changes
      brought in by the merge. As a result, later merges will only bring in tree
      changes introduced by commits that are not ancestors of the previously
      reverted merge. This may or may not be what you want.
      See the revert-a-faulty-merge How-To[1] for more details.
If you really want to change history to remove the merge from history and you are really aware of all the consequences you can use git rebase to do so:
git rebase --onto $good_commit $merge_commit branch
whereas merge_commit is the faulty merge commit and good_comit its known-good parent.
Be aware that in both cases it might be difficult to do so in case the newer commits changed code introduced by the merge commit.