
57 P.3d 775 (2002)
138 Idaho 64
Jason Clay GUSTAVES, Plaintiff-Appellant,
v.
Tricia Lee GUSTAVES, Defendant-Respondent.
No. 27588.
Supreme Court of Idaho, Idaho Falls, September 2002 Term.
October 23, 2002.
*777 Wright Wright & Johnson, PLLC, Idaho Falls, for appellant. Steven J. Wright argued.
Woolf, Combo & Thompson, Idaho Falls, for respondent. Aaron J. Woolf argued.
EISMANN, Justice.
This is a divorce action in which the central issue on appeal is the award of primary physical custody of the parties' two children. The magistrate judge awarded primary physical custody of the children to appellant Jason Gustaves, and the district judge vacated that award on appeal. We affirm the judgment of the magistrate judge.

I. FACTS AND PROCEDURAL HISTORY
Jason and Tricia married on June 5, 1993. They have two sons: Dimitri, who was born on November 1, 1993, and Tanner, who was born on February 20, 1995. On July 26, 1999, Jason filed for divorce on the ground of extreme cruelty based upon Tricia's adulterous relationship with a Steven Poulos. In addition to a division of property and debts, Jason sought primary physical custody of the two children. On September 7, 1999, Tricia filed an answer and a counterclaim, in which she sought a divorce on the ground of irreconcilable differences and primary physical custody of the two children. On March 2, 2000, Jason filed an amended complaint in which he added adultery and irreconcilable differences as grounds for the divorce. Prior to trial, the parties stipulated to all matters except the ground for the divorce, the custody of their children, and Tricia's claim for attorney fees.
The magistrate judge tried the case on June 6-9, 2000. On July 12, 2000, he issued a memorandum decision in which he found that Jason was entitled to a divorce on the ground of adultery, that it was in the children's best interests for Jason to have primary physical custody of the children, and that Tricia should be awarded attorney fees under Idaho Code § 32-604 in the sum of $1,000. In his memorandum decision, the magistrate also directed the parties to prepare a written visitation schedule and stated that child support would be pursuant to the Idaho Child Support Guidelines. Finally, the magistrate directed Jason's counsel to submit an appropriate divorce decree based upon the stipulation of the parties and the magistrate's memorandum decision.
On July 28, 2000, Tricia filed a notice of appeal from the memorandum decision. On December 15, 2000, the magistrate entered a decree of divorce. The decree simply provided that Jason was granted a divorce on the ground of adultery.[1] The decree did not address child custody, child support, the award of attorney fees to Tricia, or the division of property or debts.
On May 4, 2001, the district judge issued its decision on appeal. He determined that the magistrate judge should not have considered Tricia's adultery in its custody decision without competent evidence that there was a connection between her adultery and the welfare of the children and that the evidence did not support various factual findings. The district judge vacated the order granting primary *778 physical custody of the minor children to Jason, denied both parties' claims for attorney fees on appeal, awarded costs on appeal to Tricia, and remanded the case back to the magistrate. On May 30, 2001, Jason appealed the decision of the district judge. While that appeal was pending, this Court remanded the case to the magistrate judge for entry of a final judgment resolving the remaining issues. That judgment was entered on August 7, 2002.

II. ISSUES ON APPEAL
A. Were the magistrate judge's findings of fact and conclusions of law supported by substantial and competent evidence?
B. Did the magistrate judge err in considering Tricia's adultery as a factor when awarding primary physical custody of the two minor children?
C. Is Jason entitled to an award of attorney fees on Tricia's appeal to the district court?
D. Is either party entitled to an award of attorney fees on appeal?

III. ANALYSIS

A. Were the Magistrate Judge's Findings of Fact and Conclusions of Law Supported by Substantial and Competent Evidence?
The trial court's findings of fact will be upheld on appeal if they are supported by substantial and competent evidence. Reed v. Reed, 137 Idaho 53, 44 P.3d 1108 (2002). The weight and credibility to be given evidence is in the province of the trial court. Id. Substantial evidence is such relevant evidence as a reasonable mind might accept as adequate to support a conclusion. Howell v. Eastern Idaho R.R., Inc., 135 Idaho 733, 24 P.3d 50 (2001).

1. Was the finding, that the parties shared the care and custody of the children fairly equally from January 1998 until May 1999, supported by substantial and competent evidence?
The magistrate judge made the following finding: "Since Tricia began full time employment it appears the care of the children has been shared fairly equally between the parties. This equal caring for the children continued until May 1999." Tricia contends, and the district court found, that this finding was not supported by substantial and competent evidence.
Tricia began working full-time in January 1998. During the period from January 1998 until May 1999, Tricia testified that Jason generally left for work about a half-hour before she did, and that he returned home about twenty-five to forty-five minutes after she did. As a result, she took the boys to and picked them up from day care. She also testified that Jason stayed late at work about once a week, coming home about one-half to one hour later than usual. Jason prepared the lunches for the boys and, if they were up before he left for work, helped feed them breakfast. Both Tricia and Jason engaged in activities away from home. Jason spent a couple evenings a week at football practice during spring through autumn, every couple weeks he spent an evening at a bar, and he spent time "gaming" with his friends once every two to four weeks. Tricia spent time away from the boys visiting her grandmother quite a bit, once a month she would roll dice with other female friends, and once a month she attended meetings for a rubber stamp business. She testified that during the evenings that she and Jason were both home, they spent a fairly equal amount of time with the boys. They both participated in bathing them, preparing their meals, reading to them, and playing games with them.
The magistrate judge did not find that Jason and Tricia spent exactly equal amounts of time with the boys. The magistrate found that during the period from January 1998 until May 1999, they shared the care of the boys "fairly equally." That finding is supported by substantial and competent evidence.

2. Was the finding, that Jason was providing the majority of the care of the children for a few months in the spring and summer of 1999, supported by substantial and competent evidence?
The magistrate found, "It is apparent that for a few months in the spring and *779 summer of 1999 Jason was providing the majority of the care. This was because Tricia was spending quite a bit of time with Steve." Tricia contends, and the district court found, that this finding was not supported by substantial and competent evidence.
Jason testified that in mid-May 1999, he received a letter from Tricia, which was admitted into evidence. In that letter, Tricia wrote, "I know that you take care of them for the most part these days. I feel guilty at times and others I don't." Later in the letter, she wrote, "Bathing them at night and dressing them in the morning isn't everything, but somehow I feel guilty for not doing it for them." Tricia testified that when she wrote the letter she was referring to a period of time that had been going on for about a month. Tricia testified that she resumed having sexual intercourse with Steve in July 1999 and that by July 6, 1999, she was spending the nights with Steve. Relying upon a journal that he prepared, Jason testified that from May 13, 1999, through August 15, 1999, he provided care for the boys during seventy-six evenings and Tricia provided care during twenty-five evenings. Although Tricia testified that there were fifteen additional evenings that she provided care for the boys, there was evidence that during this period Jason provided care for the boys more evenings than she did. The magistrate judge's findings are supported by substantial and competent evidence.

3. Was the finding, that both parties equally shared the care of the children from September/October 1999 until the time of trial, supported by substantial and competent evidence?
The magistrate judge found, "Since September/October 1999 until the present the parties have been sharing equally in the care of the children. Generally the[y] have been alternating the actual care of the children every two days." Tricia contends, and the district court found, that this finding was not supported by substantial and competent evidence.
Tricia testified that in about October 1999 she and Jason agreed to alternate physical custody of the boys every two days and from that time forward they shared custody equally, as close as they could. She contends, however, that the magistrate judge's finding is erroneous because she usually picked the boys up at school and day care, she attended more parent teacher conferences than Jason, and she attended school outings and activities that Jason did not attend. The magistrate judge did not find that from September/October 1999 until trial, the parties each spent precisely the same number of minutes with the children. He found that they shared care equally by alternating physical custody every two days. That finding is supported by substantial and competent evidence.

B. Did the Magistrate Judge Err in Considering Tricia's Adultery as a Factor When Awarding Primary Physical Custody of the Two Minor Children to Jason?
When reviewing a case decided in the magistrate division that has been appealed to the district court, we review the magistrate's decision independently of, but with due regard for, the district court's intermediate appellate decision. Brinkmeyer v. Brinkmeyer, 135 Idaho 596, 21 P.3d 918 (2001). The welfare and best interest of the child is of paramount importance when awarding custody. Brownson v. Allen, 134 Idaho 60, 995 P.2d 830 (2000); IDAHO CODE § 32-717 (1996). Decisions as to the custody, care, and education of the child are committed to the sound discretion of the trial court, Osteraas v. Osteraas, 124 Idaho 350, 859 P.2d 948 (1993), and they will be upheld on appeal unless there is a clear showing of abuse of that discretion, Ratliff v. Ratliff, 129 Idaho 422, 925 P.2d 1121 (1996). When reviewing the trial court's exercise of discretion, this Court inquires: (1) whether the trial court rightly perceived the issue as one of discretion; (2) whether the trial court acted within the boundaries of such discretion and consistently with any legal standards applicable to specific choices; and (3) whether the trial court reached its decision by an exercise of reason. Brownson v. Allen, 134 Idaho 60, 995 P.2d 830 (2000).
*780 Idaho Code § 32-717 directs the trial court to "give such direction for the custody, care and education of the children of the marriage as may seem necessary or proper in the best interests of the children." The statute further directs the court to consider all relevant factors and provides a non-exhaustive list of factors that the court may consider when making its determination. Brownson v. Allen, 134 Idaho 60, 995 P.2d 830 (2000). It is axiomatic that because the statute directs the trial court to make a determination that is in the best interests of the children, the court can base its decision only upon factors that are relevant to that determination. Roeh v. Roeh, 113 Idaho 557, 746 P.2d 1016 (Ct.App.1987).
The magistrate judge considered Tricia's adultery as a relevant factor when deciding to award primary physical custody of the boys to Jason. The facts relating to her adulterous relationship were undisputed. In March 1999 Tricia met Steve Poulos when she and Jason had dinner with Steve and his wife. After that meeting, Tricia and Steve began a flirtatious relationship, talking with each other by telephone, e-mailing each other, and meeting in person. They continued to become more romantically involved until, on May 9, 1999, they engaged in sexual intercourse. Four days later, Tricia told Jason about her adultery. After doing so, she initially lessened her contact with Steve, although she did not stop it entirely. In the latter part of May, Jason convinced Tricia to see a marriage counselor with him. They met with the counselor one time, and the counselor told Tricia that she must stop all contact with Steve. She agreed, but the next day sent Steve an intimate e-mail. She also refused to continue with the marriage counseling. She began seeing Steve on a regular basis and resumed having sexual intercourse with him. During this time she continued living in the family home, but she would often leave in the evening to be with Steve and not return until early morning hours or later the next day. Tricia knew that Jason was well aware of what she was doing. Jason testified that Tricia's behavior devastated him, that he became physically ill and unable to sleep, and that the home situation and home life became extremely stressful. For five months, Tricia continued living in the family home while maintaining her relationship with Steve. Finally, in October 1999 she left the family home. The magistrate judge found that Tricia's ongoing adulterous relationship with Steve was the primary cause of the disintegration of the parties' marriage. The magistrate judge also found that Tricia's lack of concern or understanding of the problems being caused by the manner in which she openly flaunted her adulterous relationship with Steve showed a lack of maturity on her part.
Tricia argues, and the district court found, that the evidence was not sufficient to show that Tricia's adultery was relevant to the best interests of the children. The district court cited cases holding that it is improper to award custody in order to punish a parent for sexual misconduct and that a parent's sexual misconduct may be considered only if there is competent evidence showing that the sexual misconduct adversely affected the relationship between that parent and the child. Examples cited in the cases were when the misconduct occurred in the presence of the child; when the misconduct was so extreme that it showed the parent would be unfit, because of defective character, to raise the child; and when the sexual misconduct involved neglect of the child. According to the district court, the fact that the sexual misconduct caused the family to split apart, with the resultant diminishing of contact between the children and one or both parents, is not sufficient to show an adverse impact upon the welfare of the children. Rather, there must be competent evidence that the sexual misconduct itself, not the consequences of that misconduct, harmed the children. Thus, the district court discounted Jason's testimony attributing the boys' regressive behavior to Tricia's adulterous relationship because Jason conceded on cross-examination that the regressive behavior could have been caused by the fact that Jason and Tricia were no longer together. The district judge also held, sua sponte, that Jason's testimony, which was admitted without objection, should be disregarded because Jason was not competent to testify regarding the cause of the boys' regressive behavior.
*781 The magistrate judge's findings regarding the impact of Tricia's adultery were as follows:
This on-going affair was not hidden to anyone. Jason knew she was going out to meet with Steve. Tricia knew that Jason was well aware of what she was doing. Jason testified that Tricia's on-going behavior devastated him. Initially he became physically ill and was not able to sleep. The home situation and home life became extremely stressful.
. . . .
Tricia, somewhat naively asserts her relationship with Steve had no negative impact on the children. She admits Dimitri has withdrawn, become harder to handle and is now having problems with social skills. However, it is her position that Dimitri's regressive behavior is due to the divorce not any affair that she had had with Steve. She claims there is no nexus between her open and ongoing affair while living as a family with Jason and the children and any negative impact on the children.
The Court is well aware that this marriage was not perfect. It clearly had problems. Sincere efforts to salvage the marriage through counseling, etc. may have saved it even after the initial affair. But Tricia's decision to reject any efforts to mend the parties' relationship because of her passion for Steve and to continue to see Steve regularly while remaining in the home with her husband clearly ripped the family apart. To claim that such conduct had no negative effect on the children is naïve at best.
. . . .
As indicated above both parents have a close relationship with the children and have interacted with them throughout the lives of the children in an appropriate manner. Obviously there is going to be a disruption in the lives of the children due to the divorce. It appears that each parent is able to provide the same continuity and stability in the lives of the children as the other. As already indicated the Court does have some concern with the lack of maturity of the Defendant. The initial affair is not as much concern to the Court as the way the Defendant openly and continually continued on the affair with the full knowledge of her husband while living as a family unit. Such behavior does demonstrate a lack of responsibility and maturity on her part. Another indication of the lack of maturity is her unwillingness to attempt to salvage the marriage when counseling was offered. . . . Finally, her concern that there were problems in the marriage because the parties did not like the same type of music or have the same hobbies is another indication of immaturity. Nevertheless, the Court does not mean to imply that she is not a fit parent. It should be obvious from the Court's Memorandum Decision that both parties are fit and love the children and both parties care deeply for the children. There is no party who is obviously and clearly the better parent. They both seem to have fairly equal parenting skills. Nevertheless, Defendant does lack maturity and an appreciation for the sanctity of the marriage relationship.
The magistrate judge did not award Jason primary physical custody of the children in order to punish Tricia for her adultery. Likewise, the magistrate judge did not find that Tricia's adultery rendered her unfit to have primary physical custody of the children. In fact, the magistrate expressly found that both Jason and Tricia are fit parents, that they both love and care deeply for the children, that they are both good parents, that neither of them was obviously and clearly the better parent, and that they both have fairly equal parenting skills.
As part of the divorce action, the magistrate judge was required to award physical custody of the children in accordance with the best interests of the children. Unless both parties were awarded equal periods of physical custody, which neither contends should have happened, the magistrate was required to award primary physical custody to one of the parties. The magistrate found that both parties were fit to be awarded physical custody and that they had fairly equal parenting skills. In making the choice between the two, the magistrate judge concluded that the impact on the family resulting from the manner in which Tricia openly *782 engaged in her adulterous relationship prior to separation, the immaturity shown by Tricia's conduct, and the impact upon the children resulting from her conduct and the ensuing divorce tipped the scales in favor of awarding primary physical custody of the children to Jason. Tricia has failed to show that the magistrate judge abused his discretion in awarding custody.

C. Is Jason Entitled to an Award of Attorney Fees on Tricia's Appeal to the District Court?
Jason seeks an award of attorney fees under Idaho Code § 12-121 on Tricia's appeal to the district court. Attorney fees can be awarded under that statute to the respondent on appeal if the appeal was brought or pursued frivolously, unreasonably, or without foundation. Reed v. Reed, 137 Idaho 53, 44 P.3d 1108 (2002). An award of attorney fees is appropriate if the appellant simply invites the appellate court to second-guess the trial court on conflicting evidence. Id. We decline to award attorney fees under § 12-121. Tricia's appeal to the district court presented a legal question of first impression, namely whether in awarding custody the relevance of a parent's sexual misconduct should be narrowly circumscribed as in the cases relied upon by the district court.

D. Is Either Party Entitled to an Award of Attorney Fees on Appeal?
Both parties seek an award of attorney fees on appeal under both Idaho Code §§ 12-121 and 32-704. Because Tricia is not the prevailing party on appeal, she will not be awarded attorney fees under Idaho Code § 12-121. Jason could be awarded attorney fees on appeal under Idaho Code § 12-121 only if Tricia defended the appeal frivolously, unreasonably, or without foundation. For the same reason that we declined to award Jason attorney fees on Tricia's appeal to the district court, we decline to award him attorney fees on this appeal.
Both parties also request an award of attorney fees under Idaho Code § 32-704(3). There is nothing in the record indicating that either party presented a request for an award of attorney fees under that statute to either the magistrate judge or the district judge in order to pursue this appeal, nor did they provide any information to this Court to support such request. Jason provided no information supporting an award of attorney fees under Idaho Code § 32-704(3), and Tricia merely alleged in her brief that she "is without sufficient funds to defend this appeal." We therefore will not award either of them attorney fees under Idaho Code § 32-704(3). Browning v. Browning, 136 Idaho 691, 39 P.3d 631 (2001).

IV. CONCLUSION
We vacate the decision on appeal of the district judge, including its award of costs to Tricia, and affirm the judgment of the magistrate judge. We award costs on appeal, but not attorney fees, to Jason.
Chief Justice TROUT, and Justices SCHROEDER, WALTERS and KIDWELL concur.
NOTES
[1]  The full text of the decree of divorce is as follows:

Based upon the Court's Memorandum Decision entered on July 12, 2000, and good cause appearing therefore;
THIS COURT ORDERS, ADJUDGES AND DECREES as follows:
1. That the bonds of matrimony hereto existing between the Plaintiff and the Defendant are hereby and the same are dissolved and the Plaintiff is granted an absolute divorce on the grounds of adultery pursuant to Idaho Code § 32-603.
DATED this 15 day of December, 2000.
