A Michigan man put up quite a fight against a bear as it tried to attack his barking beagle earlier this month.

The Boyne Falls man let his dog outside around 4:30 a.m. When he returned minutes later to let the dog back in, he spotted a large shadow moving slowly across his driveway. He soon realized it was a black bear — the only species of bear living in the state.

"When his beagle barked at the bear it circled around and swatted at the dog as the owner frantically tried to pull him in only to have the leash get tangled," according to a report recently released by the Michigan Department of Natural Resources (DNR).

The owner repeatedly kicked the bear as he struggled to untangle the leash. At first, the bear retreated. But then the animal returned and bit the dog.

That's when the man punched the bear in the nose. The blow to the snout caused the bear to pause just long enough for the man to escape inside his house with the dog.

He then called the Michigan DNR and conservation officer Andrea Erratt arrived at the scene.

"Erratt advised the homeowner to remove all his bird feeders, clean up all the sunflower seed husks, spread some moth balls, and stop feeding corn to the deer and turkeys in the backyard," the report states.

The owner agreed and then rushed his dog to a veterinarian, where it received several stitches in its side and rear.

There are up to 19,000 black bears roaming the state of Michigan — with about 90 percent living upstate, Michigan.gov explains on its website. Typically, black bears are "shy by nature" but they have been known to attack on occasion, the site says.

“When bears stand their ground, people should do the same thing,” Kevin Swanson, wildlife specialist with the Michigan DNR's bear and wolf program, advised in an online statement. “In these kind of encounters, you should make loud noises and back away from the bear slowly, giving the bear plenty of room to leave the area. Do not run from a black bear or play dead if one approaches.”